-
Notifications
You must be signed in to change notification settings - Fork 1.2k
add actionlint to check github actions #6337
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
witoszekdev
wants to merge
5
commits into
main
Choose a base branch
from
add-actionlint
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
88698db
add actionlint to check github actions
witoszekdev 66ebf59
fix workflow failing
witoszekdev cbad358
fix actionlint failing lint command, remove separate actionlint step
witoszekdev f7d5c33
add changeset
witoszekdev 4f49571
Merge branch 'main' into add-actionlint
witoszekdev 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,5 @@ | ||
| --- | ||
| "saleor-dashboard": patch | ||
| --- | ||
|
|
||
| Added `actionlint` for linting project's Github Actions |
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,48 @@ | ||||||
| #!/bin/bash | ||||||
| # Downloads actionlint binary into node_modules/.bin/ so it's available | ||||||
| # for pnpm scripts and lint-staged without requiring Go or brew. | ||||||
| # Based on https://github.com/rhysd/actionlint/blob/main/scripts/download-actionlint.bash | ||||||
|
|
||||||
| set -euo pipefail | ||||||
|
|
||||||
| VERSION="1.7.10" | ||||||
| TARGET_DIR="$(cd "$(dirname "$0")/../node_modules/.bin" && pwd)" | ||||||
| BINARY="$TARGET_DIR/actionlint" | ||||||
|
|
||||||
| if [ -x "$BINARY" ] && "$BINARY" -version 2>/dev/null | grep -q "$VERSION"; then | ||||||
| echo "actionlint v${VERSION} already installed" | ||||||
| exit 0 | ||||||
| fi | ||||||
|
|
||||||
| case "$OSTYPE" in | ||||||
| linux*) os=linux; ext=tar.gz ;; | ||||||
| darwin*) os=darwin; ext=tar.gz ;; | ||||||
| msys|cygwin|win32) os=windows; ext=zip ;; | ||||||
| *) echo "Unsupported OS: $OSTYPE" >&2; exit 1 ;; | ||||||
| esac | ||||||
|
|
||||||
| machine="$(uname -m)" | ||||||
| case "$machine" in | ||||||
| x86_64) arch=amd64 ;; | ||||||
| i?86) arch=386 ;; | ||||||
| aarch64|arm64) arch=arm64 ;; | ||||||
| arm*) arch=armv6 ;; | ||||||
| *) echo "Unsupported arch: $machine" >&2; exit 1 ;; | ||||||
| esac | ||||||
|
|
||||||
| file="actionlint_${VERSION}_${os}_${arch}.${ext}" | ||||||
| url="https://github.com/rhysd/actionlint/releases/download/v${VERSION}/${file}" | ||||||
|
|
||||||
| echo "Downloading actionlint v${VERSION} (${os}/${arch})..." | ||||||
| mkdir -p "$TARGET_DIR" | ||||||
|
|
||||||
| if [ "$os" = "windows" ]; then | ||||||
| tmpdir="$(mktemp -d)" | ||||||
| curl -sSL -o "$tmpdir/tmp.zip" "$url" | ||||||
|
Member
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. Missing the
Suggested change
|
||||||
| unzip -o "$tmpdir/tmp.zip" actionlint.exe -d "$TARGET_DIR" | ||||||
| rm -rf "$tmpdir" | ||||||
| else | ||||||
| curl -sSL "$url" | tar xz -C "$TARGET_DIR" actionlint | ||||||
|
Member
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.
Suggested change
|
||||||
| fi | ||||||
|
|
||||||
| echo "Installed: $("$BINARY" -version)" | ||||||
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Could we at least use the checksums to ensure the release doesn't mutate as they don't use immutable releases?
The checksums (they need to be stored raw in our repo in this file or file next to it):
You can grep the correct line based on the file name that you generate (e.g.,
actionlint_1.7.10_windows_amd64.zip), then dosha256sum -c -For example, let's say we have
checksums.txtstored them, then we can do this:(assumes that the filename isn't changed, you could alter
curlcommand with-o "$file"to make it consistent, it makes it a bit simpler as otherwise we would need intermediary variables)