-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add actionlint checks for GitHub Actions #16316
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
Open
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7851964
Add actionlint checks for GitHub Actions
AlexWaygood 5281dc2
Run actionlint in GitHub Actions instead of pre-commit.ci
AlexWaygood 4835091
Show actionlint progress in CI
AlexWaygood b52f6e0
Demonstrate actionlint failure with an unquoted variable
AlexWaygood fc05e21
Revert "Demonstrate actionlint failure with an unquoted variable"
AlexWaygood fca65d4
Update .github/workflows/actionlint.yml
AlexWaygood File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| name: Lint GitHub Actions workflows | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - ".github/workflows/**" | ||
| pull_request: | ||
| paths: | ||
| - ".github/workflows/**" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| actionlint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Run actionlint | ||
| # This is the recommended way to run actionlint in CI: | ||
| # https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions. | ||
| # The actionlint pre-commit hook would be an alternative, | ||
| # but it causes our pre-commit CI jobs to time out. | ||
| # The Docker image includes ShellCheck and Pyflakes. | ||
| uses: docker://rhysd/actionlint:1.7.12@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667 | ||
| with: | ||
| args: -color -verbose | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,21 +85,28 @@ jobs: | |
| shell: bash | ||
| run: | | ||
| PACKAGES=$(python tests/get_stubtest_system_requirements.py) | ||
| PACKAGE_ARGS=() | ||
| while IFS= read -r package; do | ||
| PACKAGE_ARGS+=("$package") | ||
| done <<< "$PACKAGES" | ||
|
Comment on lines
+88
to
+91
Collaborator
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. Why do we need this? I assume this was flagged due to white space handling. But since package names can not contain white space, I think this only complicates the action unnecessarily and makes it harder to understand and verify its correctness. (Same pattern a few times below.) |
||
|
|
||
| if [ "${{ runner.os }}" = "Linux" ]; then | ||
| if [ -n "$PACKAGES" ]; then | ||
| printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n" | ||
| sudo apt-get update -q && sudo apt-get install -qy $PACKAGES | ||
| printf 'Installing APT packages:\n' | ||
| printf ' %s\n' "${PACKAGE_ARGS[@]}" | ||
| sudo apt-get update -q && sudo apt-get install -qy "${PACKAGE_ARGS[@]}" | ||
| fi | ||
| else | ||
| if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then | ||
| printf "Installing Homebrew packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n" | ||
| brew install -q $PACKAGES | ||
| printf 'Installing Homebrew packages:\n' | ||
| printf ' %s\n' "${PACKAGE_ARGS[@]}" | ||
| brew install -q "${PACKAGE_ARGS[@]}" | ||
| fi | ||
|
|
||
| if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then | ||
| printf "Installing Chocolatey packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n" | ||
| choco install -y $PACKAGES | ||
| printf 'Installing Chocolatey packages:\n' | ||
| printf ' %s\n' "${PACKAGE_ARGS[@]}" | ||
| choco install -y "${PACKAGE_ARGS[@]}" | ||
| fi | ||
| fi | ||
| - name: Run stubtest | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Nit (which I hope renovate handles correctly):