From 87c4f3eacdd5303d43f9912517b72dc9cecfb7ac Mon Sep 17 00:00:00 2001 From: Dariusz Porowski <3431813+DariuszPorowski@users.noreply.github.com> Date: Sat, 9 Mar 2024 09:54:38 -0800 Subject: [PATCH 1/6] feat(action): add base-url --- README.md | 24 +++++++++++++----------- action.yml | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index fe80b0b..312405d 100644 --- a/README.md +++ b/README.md @@ -68,17 +68,19 @@ Action returns some basic information. For more details, follow [📤 Outputs](# ## 📥 Inputs -| Name | Required | Type | Default value | Description | -| :-------------: | :------: | :------: | :-----------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `version` | false | `string` | `latest` | SemVer version of `actionlint`, recommended to keep default: latest | -| `matcher` | false | `bool` | `true` | Use matcher for GitHub annotations | -| `files` | false | `string` | *not set* | To lint different workflow files (default searching directory is `.github/workflows`), use comma-separated glob patterns, e.g., `tests/*.yml, tests/*.yaml` | -| `flags` | false | `string` | *not set* | Extra flags to use with `actionlint` | -| `group-result` | false | `bool` | `true` | Use the GitHub log grouping feature for failure actionlint results. | -| `fail-on-error` | false | `bool` | `true` | Fail action on `actionlint` errors | -| `shellcheck` | false | `bool` | `true` | Use `shellcheck` with `actionlint` (and install if it does not exist) | -| `pyflakes` | false | `bool` | `true` | Use `pyflakes` with `actionlint` (and install if it does not exist) | -| `cache` | false | `bool` | `true` | Use GitHub cache for caching binaries for the next runs | +| Name | Required | Type | Default value | Description | +| :-------------: | :------: | :------: | :--------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `version` | false | `string` | `latest` | SemVer version of `actionlint`, recommended to keep default: `latest` | +| `matcher` | false | `bool` | `true` | Use matcher for GitHub annotations. | +| `files` | false | `string` | *not set* | To lint different workflow files (default searching directory is `.github/workflows`), use comma-separated glob patterns, e.g., `tests/*.yml, tests/*.yaml` | +| `flags` | false | `string` | *not set* | Extra flags to use with `actionlint` | +| `group-result` | false | `bool` | `true` | Use the GitHub log grouping feature for failure actionlint results. | +| `fail-on-error` | false | `bool` | `true` | Fail action on `actionlint` errors. | +| `shellcheck` | false | `bool` | `true` | Use `shellcheck` with `actionlint` (and install if it does not exist) | +| `pyflakes` | false | `bool` | `true` | Use `pyflakes` with `actionlint` (and install if it does not exist) | +| `cache` | false | `bool` | `true` | Use GitHub cache for caching binaries for the next runs. | +| `token` | false | `string` | `github.token` | GitHub Token for API authentication. | +| `base-url` | false | `string` | `github.api_url` | GitHub REST API URL to connect to a different GitHub instance. For example, `https://my.github-enterprise-server.com/api/v3` | ## 📤 Outputs diff --git a/action.yml b/action.yml index a2c597c..58cda4e 100644 --- a/action.yml +++ b/action.yml @@ -56,6 +56,10 @@ inputs: description: GitHub Token required: false default: ${{ github.token }} + base-url: + description: GitHub REST API URL + required: false + default: ${{ github.api_url }} outputs: version-semver: description: SemVer version @@ -87,6 +91,7 @@ runs: id: environment with: github-token: ${{ inputs.token || env.GITHUB_TOKEN }} + base-url: "https://api.github.com" script: | // input envs const { INPUT_TOOL_NAME, INPUT_TOOL_SEMVER, INPUT_REPO_OWNER, INPUT_REPO_NAME, RUNNER_TEMP } = process.env @@ -202,10 +207,12 @@ runs: shell: ${{ (runner.os == 'Windows' && 'pwsh') || 'bash' }} working-directory: ${{ inputs.working-directory }} - - uses: actions/github-script@v7 + - name: Download tool + uses: actions/github-script@v7 if: ${{ steps.tool-cache.outputs.cache-hit != 'true' }} with: github-token: ${{ inputs.token || env.GITHUB_TOKEN }} + base-url: ${{ inputs.base-url }} script: | // dependencies const tc = require('@actions/tool-cache') @@ -243,6 +250,7 @@ runs: id: tool-dependencies with: github-token: ${{ inputs.token || env.GITHUB_TOKEN }} + base-url: ${{ inputs.base-url }} script: | // input envs const { INPUT_PYFLAKES, INPUT_SHELLCHECK } = process.env @@ -303,10 +311,12 @@ runs: INPUT_PYFLAKES: ${{ inputs.pyflakes }} INPUT_SHELLCHECK: ${{ inputs.shellcheck }} - - uses: actions/github-script@v7 + - name: Run tool + uses: actions/github-script@v7 id: tool-runner with: github-token: ${{ inputs.token || env.GITHUB_TOKEN }} + base-url: ${{ inputs.base-url }} script: | // input envs const { INPUT_FILES, INPUT_FLAGS, INPUT_TOOL_NAME, INPUT_TOOL_DIR_PATH, INPUT_MATCHER, INPUT_MATCHER_PATH, INPUT_TOOL_EXECUTABLE, INPUT_JSON, INPUT_FAIL_ON_ERROR, INPUT_PYFLAKES, INPUT_SHELLCHECK, INPUT_GROUP_RESULT, DEBUG } = process.env From 2f8e607cda9ee435f38475c7325635adb70064a2 Mon Sep 17 00:00:00 2001 From: Dariusz Porowski <3431813+DariuszPorowski@users.noreply.github.com> Date: Sat, 9 Mar 2024 10:47:50 -0800 Subject: [PATCH 2/6] chore(action): naming --- README.md | 26 +++++++++++++------------- action.yml | 24 +++++++++++++++--------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 312405d..d3f1014 100644 --- a/README.md +++ b/README.md @@ -68,19 +68,19 @@ Action returns some basic information. For more details, follow [📤 Outputs](# ## 📥 Inputs -| Name | Required | Type | Default value | Description | -| :-------------: | :------: | :------: | :--------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `version` | false | `string` | `latest` | SemVer version of `actionlint`, recommended to keep default: `latest` | -| `matcher` | false | `bool` | `true` | Use matcher for GitHub annotations. | -| `files` | false | `string` | *not set* | To lint different workflow files (default searching directory is `.github/workflows`), use comma-separated glob patterns, e.g., `tests/*.yml, tests/*.yaml` | -| `flags` | false | `string` | *not set* | Extra flags to use with `actionlint` | -| `group-result` | false | `bool` | `true` | Use the GitHub log grouping feature for failure actionlint results. | -| `fail-on-error` | false | `bool` | `true` | Fail action on `actionlint` errors. | -| `shellcheck` | false | `bool` | `true` | Use `shellcheck` with `actionlint` (and install if it does not exist) | -| `pyflakes` | false | `bool` | `true` | Use `pyflakes` with `actionlint` (and install if it does not exist) | -| `cache` | false | `bool` | `true` | Use GitHub cache for caching binaries for the next runs. | -| `token` | false | `string` | `github.token` | GitHub Token for API authentication. | -| `base-url` | false | `string` | `github.api_url` | GitHub REST API URL to connect to a different GitHub instance. For example, `https://my.github-enterprise-server.com/api/v3` | +| Name | Required | Type | Default value | Description | +| :--------------: | :------: | :------: | :--------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `version` | false | `string` | `latest` | SemVer version of `actionlint`, recommended to keep default: `latest` | +| `matcher` | false | `bool` | `true` | Use matcher for GitHub annotations. | +| `files` | false | `string` | _not set_ | To lint different workflow files (default searching directory is `.github/workflows`), use comma-separated glob patterns, e.g., `tests/*.yml, tests/*.yaml` | +| `flags` | false | `string` | _not set_ | Extra flags to use with `actionlint` | +| `group-result` | false | `bool` | `true` | Use the GitHub log grouping feature for failure actionlint results. | +| `fail-on-error` | false | `bool` | `true` | Fail action on `actionlint` errors. | +| `shellcheck` | false | `bool` | `true` | Use `shellcheck` with `actionlint` (and install if it does not exist) | +| `pyflakes` | false | `bool` | `true` | Use `pyflakes` with `actionlint` (and install if it does not exist) | +| `cache` | false | `bool` | `true` | Use GitHub cache for caching binaries for the next runs. | +| `github-token` | false | `string` | `github.token` | GitHub Token for API authentication. | +| `github-api-url` | false | `string` | `github.api_url` | GitHub REST API URL to connect to a different GitHub instance. For example, `https://my.github-enterprise-server.com/api/v3` | ## 📤 Outputs diff --git a/action.yml b/action.yml index 58cda4e..f72a0a0 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,6 @@ ---- +# yaml-language-server: $schema=https://json.schemastore.org/github-action.json # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions +--- name: actionlint description: ✅ Run actionlint for validating your GitHub Actions workflow files. author: Dariusz Porowski @@ -56,7 +57,12 @@ inputs: description: GitHub Token required: false default: ${{ github.token }} - base-url: + deprecationMessage: Use `github-token` input instead + github-token: + description: GitHub Token + required: false + default: ${{ github.token }} + github-api-url: description: GitHub REST API URL required: false default: ${{ github.api_url }} @@ -90,7 +96,7 @@ runs: uses: actions/github-script@v7 id: environment with: - github-token: ${{ inputs.token || env.GITHUB_TOKEN }} + github-token: ${{ inputs.github-token || inputs.token || env.GITHUB_TOKEN }} base-url: "https://api.github.com" script: | // input envs @@ -211,8 +217,8 @@ runs: uses: actions/github-script@v7 if: ${{ steps.tool-cache.outputs.cache-hit != 'true' }} with: - github-token: ${{ inputs.token || env.GITHUB_TOKEN }} - base-url: ${{ inputs.base-url }} + github-token: ${{ inputs.github-token || inputs.token || env.GITHUB_TOKEN }} + base-url: ${{ inputs.github-api-url }} script: | // dependencies const tc = require('@actions/tool-cache') @@ -249,8 +255,8 @@ runs: if: ${{ inputs.pyflakes == 'true' || inputs.shellcheck == 'true' }} id: tool-dependencies with: - github-token: ${{ inputs.token || env.GITHUB_TOKEN }} - base-url: ${{ inputs.base-url }} + github-token: ${{ inputs.github-token || inputs.token || env.GITHUB_TOKEN }} + base-url: ${{ inputs.github-api-url }} script: | // input envs const { INPUT_PYFLAKES, INPUT_SHELLCHECK } = process.env @@ -315,8 +321,8 @@ runs: uses: actions/github-script@v7 id: tool-runner with: - github-token: ${{ inputs.token || env.GITHUB_TOKEN }} - base-url: ${{ inputs.base-url }} + github-token: ${{ inputs.github-token || inputs.token || env.GITHUB_TOKEN }} + base-url: ${{ inputs.github-api-url }} script: | // input envs const { INPUT_FILES, INPUT_FLAGS, INPUT_TOOL_NAME, INPUT_TOOL_DIR_PATH, INPUT_MATCHER, INPUT_MATCHER_PATH, INPUT_TOOL_EXECUTABLE, INPUT_JSON, INPUT_FAIL_ON_ERROR, INPUT_PYFLAKES, INPUT_SHELLCHECK, INPUT_GROUP_RESULT, DEBUG } = process.env From cffd6fb0be2f321ac068d3bcd46f043383c90460 Mon Sep 17 00:00:00 2001 From: Dariusz Porowski <3431813+DariuszPorowski@users.noreply.github.com> Date: Mon, 13 May 2024 13:58:27 -0700 Subject: [PATCH 3/6] refactor: use github-api-url-public --- README.md | 2 +- action.yml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d3f1014..92dc3f1 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ Action returns some basic information. For more details, follow [📤 Outputs](# | `pyflakes` | false | `bool` | `true` | Use `pyflakes` with `actionlint` (and install if it does not exist) | | `cache` | false | `bool` | `true` | Use GitHub cache for caching binaries for the next runs. | | `github-token` | false | `string` | `github.token` | GitHub Token for API authentication. | -| `github-api-url` | false | `string` | `github.api_url` | GitHub REST API URL to connect to a different GitHub instance. For example, `https://my.github-enterprise-server.com/api/v3` | +| `github-api-url-public` | false | `string` | `github.api_url` | Public GitHub REST API URL to connect to for dependencies download. For example, `https://api.github.com`. Required if you are running in the GHES. | ## 📤 Outputs diff --git a/action.yml b/action.yml index f72a0a0..eae41bf 100644 --- a/action.yml +++ b/action.yml @@ -62,8 +62,8 @@ inputs: description: GitHub Token required: false default: ${{ github.token }} - github-api-url: - description: GitHub REST API URL + github-api-url-public: + description: Public GitHub REST API URL for dependencies download required: false default: ${{ github.api_url }} outputs: @@ -217,8 +217,8 @@ runs: uses: actions/github-script@v7 if: ${{ steps.tool-cache.outputs.cache-hit != 'true' }} with: - github-token: ${{ inputs.github-token || inputs.token || env.GITHUB_TOKEN }} - base-url: ${{ inputs.github-api-url }} + # github-token: ${{ inputs.github-token || inputs.token || env.GITHUB_TOKEN }} + base-url: ${{ inputs.github-api-url-public }} script: | // dependencies const tc = require('@actions/tool-cache') @@ -256,7 +256,7 @@ runs: id: tool-dependencies with: github-token: ${{ inputs.github-token || inputs.token || env.GITHUB_TOKEN }} - base-url: ${{ inputs.github-api-url }} + # base-url: ${{ inputs.github-api-url }} script: | // input envs const { INPUT_PYFLAKES, INPUT_SHELLCHECK } = process.env @@ -322,7 +322,7 @@ runs: id: tool-runner with: github-token: ${{ inputs.github-token || inputs.token || env.GITHUB_TOKEN }} - base-url: ${{ inputs.github-api-url }} + # base-url: ${{ inputs.github-api-url }} script: | // input envs const { INPUT_FILES, INPUT_FLAGS, INPUT_TOOL_NAME, INPUT_TOOL_DIR_PATH, INPUT_MATCHER, INPUT_MATCHER_PATH, INPUT_TOOL_EXECUTABLE, INPUT_JSON, INPUT_FAIL_ON_ERROR, INPUT_PYFLAKES, INPUT_SHELLCHECK, INPUT_GROUP_RESULT, DEBUG } = process.env From 5ca534f8dc2f4cc034c5fdacb433cbc25f3a814c Mon Sep 17 00:00:00 2001 From: Dariusz Porowski <3431813+DariuszPorowski@users.noreply.github.com> Date: Mon, 13 May 2024 14:15:32 -0700 Subject: [PATCH 4/6] refactor: switch to pipx --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index eae41bf..2833937 100644 --- a/action.yml +++ b/action.yml @@ -282,7 +282,7 @@ runs: core.debug(`${pyflakesBinary} exists: ${pyflakesExists}`) if (pyflakesExists === false) { - await exec.exec('python3', ['-m', 'pip', 'install', '--upgrade', 'pyflakes']) + await exec.exec('pipx', ['install', 'pyflakes']) } } From 201ed64d43cd5d583f35a5ff609f84f21a046593 Mon Sep 17 00:00:00 2001 From: Dariusz Porowski <3431813+DariuszPorowski@users.noreply.github.com> Date: Mon, 13 May 2024 14:25:29 -0700 Subject: [PATCH 5/6] chore(deps): bump pre-commit --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 30df3b0..434badb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: # files: .pre-commit-config.yaml - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-symlinks - id: trailing-whitespace @@ -40,7 +40,7 @@ repos: exclude: package-lock.json - repo: https://github.com/gitleaks/gitleaks - rev: v8.18.0 + rev: v8.18.2 hooks: - id: gitleaks args: From 05c802a6afe09097f5e320b78fb0976815a92de3 Mon Sep 17 00:00:00 2001 From: Dariusz Porowski <3431813+DariuszPorowski@users.noreply.github.com> Date: Sun, 26 May 2024 10:02:47 -0700 Subject: [PATCH 6/6] fix: switch environment to github-api-url-public --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 2833937..268c861 100644 --- a/action.yml +++ b/action.yml @@ -96,8 +96,8 @@ runs: uses: actions/github-script@v7 id: environment with: - github-token: ${{ inputs.github-token || inputs.token || env.GITHUB_TOKEN }} - base-url: "https://api.github.com" + # github-token: ${{ inputs.github-token || inputs.token || env.GITHUB_TOKEN }} + base-url: ${{ inputs.github-api-url-public }} script: | // input envs const { INPUT_TOOL_NAME, INPUT_TOOL_SEMVER, INPUT_REPO_OWNER, INPUT_REPO_NAME, RUNNER_TEMP } = process.env