diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml index 5f636b1..b5d5515 100644 --- a/.github/workflows/test-action.yml +++ b/.github/workflows/test-action.yml @@ -42,6 +42,8 @@ jobs: uses: ./ with: version: 'v3.5.1' + yamllint_version: '1.27.1' + yamale_version: '3.0.4' - name: Check install! run: | ct version diff --git a/README.md b/README.md index f6511c9..3e80515 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ A GitHub Action for installing the [helm/chart-testing](https://github.com/helm/ For more information on inputs, see the [API Documentation](https://developer.github.com/v3/repos/releases/#input) - `version`: The chart-testing version to install (default: `v3.7.0`) +- `yamllint_version`: The chart-testing version to install (default: `1.27.1`) +- `yamale_version`: The chart-testing version to install (default: `3.0.4`) ### Example Workflow diff --git a/action.yml b/action.yml index 4d16da7..b882cb2 100644 --- a/action.yml +++ b/action.yml @@ -9,8 +9,21 @@ inputs: description: "The chart-testing version to install (default: v3.7.0)" required: false default: v3.7.0 + yamllint_version: + description: "The yamllint version to install (default: 1.27.1)" + required: false + default: '1.27.1' + yamale_version: + description: "The yamale version to install (default: 3.0.4)" + required: false + default: '3.0.4' runs: using: composite steps: - - run: "$GITHUB_ACTION_PATH/ct.sh --version ${{ inputs.version }}" + - run: | + cd $GITHUB_ACTION_PATH \ + && ./ct.sh \ + --version ${{ inputs.version }} \ + --yamllint-version ${{ inputs.yamllint_version }} \ + --yamale-version ${{ inputs.yamale_version }} shell: bash diff --git a/ct.sh b/ct.sh index 36cf6e4..bd35db1 100755 --- a/ct.sh +++ b/ct.sh @@ -5,6 +5,8 @@ set -o nounset set -o pipefail DEFAULT_CHART_TESTING_VERSION=v3.7.0 +DEFAULT_YAMLLINT_VERSION=1.27.1 +DEFAULT_YAMALE_VERSION=3.0.4 show_help() { cat << EOF @@ -17,6 +19,8 @@ EOF main() { local version="$DEFAULT_CHART_TESTING_VERSION" + local yamllint_version="$DEFAULT_YAMLLINT_VERSION" + local yamale_version="$DEFAULT_YAMALE_VERSION" parse_command_line "$@" @@ -40,6 +44,26 @@ parse_command_line() { exit 1 fi ;; + --yamllint-version) + if [[ -n "${2:-}" ]]; then + yamllint_version="$2" + shift + else + echo "ERROR: '--yamllint-version' cannot be empty." >&2 + show_help + exit 1 + fi + ;; + --yamale-version) + if [[ -n "${2:-}" ]]; then + yamale_version="$2" + shift + else + echo "ERROR: '--yamale-version' cannot be empty." >&2 + show_help + exit 1 + fi + ;; *) break ;; @@ -76,10 +100,10 @@ install_chart_testing() { source "$venv_dir/bin/activate" echo 'Installing yamllint...' - pip3 install yamllint==1.27.1 + pip3 install "yamllint==${yamllint_version}" echo 'Installing Yamale...' - pip3 install yamale==3.0.4 + pip3 install "yamale==${yamale_version}" fi # https://github.com/helm/chart-testing-action/issues/62