-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(action): add base-url #22
base: main
Are you sure you want to change the base?
Changes from 2 commits
87c4f3e
2f8e607
cffd6fb
5ca534f
201ed64
05c802a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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,6 +57,15 @@ inputs: | |
description: GitHub Token | ||
required: false | ||
default: ${{ github.token }} | ||
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 }} | ||
outputs: | ||
version-semver: | ||
description: SemVer version | ||
|
@@ -86,7 +96,8 @@ 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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will not work (and breaks as expected in my tests due to a I think you would need to introduce an additional Additionally we should allow not using a token at all when accessing the API (unauthenticated request). These calls are heavily rate-limited, but our GHES workflow may not have access to any GitHub.com token at all. The list releases API is available without authentication:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @frederikb great input! thanks for checking. Going to address your suggestions today, and appreciate GHES test after will update this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @frederikb the problem with anonymous GH public api calls is, it's a very limited rate limits: |
||
script: | | ||
// input envs | ||
const { INPUT_TOOL_NAME, INPUT_TOOL_SEMVER, INPUT_REPO_OWNER, INPUT_REPO_NAME, RUNNER_TEMP } = process.env | ||
|
@@ -202,10 +213,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 }} | ||
github-token: ${{ inputs.github-token || inputs.token || env.GITHUB_TOKEN }} | ||
base-url: ${{ inputs.github-api-url }} | ||
script: | | ||
// dependencies | ||
const tc = require('@actions/tool-cache') | ||
|
@@ -242,7 +255,8 @@ runs: | |
if: ${{ inputs.pyflakes == 'true' || inputs.shellcheck == 'true' }} | ||
id: tool-dependencies | ||
with: | ||
github-token: ${{ inputs.token || env.GITHUB_TOKEN }} | ||
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 | ||
|
@@ -303,10 +317,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 }} | ||
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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't actually needed in my option.
github.api_url
will point to the correct API URL of the GHES instance.