Repository navigation
ci: apply the repo standard and separate scan failures from findings (EN-214) #1291
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
eeef72f
fix(security): report scan failures separately from vulnerabilities (…
CK-7vn 5a0e07c
ci(commits): name the commit check conventional commits (EN-214)
CK-7vn 86f13b2
chore(github): add default code owners and a Release section to the P…
CK-7vn d77411b
ci: pin third-party actions by commit SHA (EN-214)
CK-7vn cec0d00
docs: add the repository standard and ruleset apply steps (EN-214)
CK-7vn 71fb5c3
ci(commits): use the shared commit check instead of the webiny action…
CK-7vn 87479c9
ci: align workflows and templates with the repo standard (EN-214)
CK-7vn 5abb1ec
docs: route new repos through unlocked-product-template (EN-214)
CK-7vn 5e53c81
docs: add the template and product repos to the repo standard (EN-214)
CK-7vn b51ef13
fix(deps): upgrade frontend lockfile past high-severity advisories (E…
CK-7vn 23b3744
fix(deps): bump vite to 6.4.4 for the launch-editor advisory (EN-214)
CK-7vn 1559e33
fix(ci): fail the commit check when the commit range cannot be read (…
CK-7vn 649c8d6
docs: mark breaking commits for merge and rebase merges in the PR tem…
CK-7vn 2f07107
ci: run lint and tests with a read-only token and pin govulncheck (EN…
CK-7vn c7d9847
docs: swap the ruleset once every check but conventional passes (EN-214)
CK-7vn a592898
docs: swap the ruleset once every check but conventional passes (EN-214)
CK-7vn 99e4dcf
docs: backport the check rename after the ruleset swap (EN-214)
CK-7vn 357db0f
docs: rebase release-branch PRs after the backport (EN-214)
CK-7vn 3618090
Merge remote-tracking branch 'origin/main' into EN-214-repo-standards
CK-7vn 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 |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| * @UnlockedLabs/reviewers | ||
| backend/**/* @UnlockedLabs/reviewers | ||
| config/**/* @UnlockedLabs/reviewers | ||
| frontend/**/* @UnlockedLabs/reviewers |
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,38 @@ | ||
| #!/usr/bin/env bash | ||
| # Classify a dependency scan: clean, vulnerabilities_found or scan_failed. | ||
| # Usage: scan-result.sh <go|yarn> <exit-code> [yarn-output-file] | ||
| set -uo pipefail | ||
|
|
||
| tool="${1:-}" | ||
| code="${2:-}" | ||
| out="${3:-}" | ||
|
|
||
| case "$code" in | ||
| ''|*[!0-9]*) echo scan_failed; exit 0 ;; | ||
| esac | ||
|
|
||
| case "$tool" in | ||
| go) | ||
| # govulncheck: 0 clean, 3 vulnerabilities, anything else is a tool or network failure | ||
| case "$code" in | ||
| 0) echo clean ;; | ||
| 3) echo vulnerabilities_found ;; | ||
| *) echo scan_failed ;; | ||
| esac | ||
| ;; | ||
| yarn) | ||
| # yarn 1 exits with a bitmask (8 high, 16 critical, lower bits set whatever --level says) | ||
| if [ "$code" -gt 31 ]; then | ||
| echo scan_failed | ||
| elif [ "$code" -eq 0 ]; then | ||
| echo clean | ||
| elif [ $((code & 24)) -ne 0 ]; then | ||
| echo vulnerabilities_found | ||
| elif [ -f "$out" ] && grep -q 'Packages audited' "$out"; then | ||
| echo clean | ||
| else | ||
| echo scan_failed | ||
| fi | ||
| ;; | ||
| *) echo scan_failed ;; | ||
| esac |
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,55 @@ | ||
| #!/usr/bin/env bash | ||
| set -uo pipefail | ||
|
|
||
| here="$(cd "$(dirname "$0")" && pwd)" | ||
| script="$here/scan-result.sh" | ||
| tmp="$(mktemp -d)" | ||
| trap 'rm -rf "$tmp"' EXIT | ||
|
|
||
| completed="$tmp/completed.txt" | ||
| failed="$tmp/failed.txt" | ||
| printf '188 vulnerabilities found - Packages audited: 493\n' > "$completed" | ||
| printf 'error An unexpected error occurred: "getaddrinfo ENOTFOUND"\n' > "$failed" | ||
|
|
||
| fails=0 | ||
| check() { | ||
| local want="$1"; shift | ||
| local got | ||
| got="$("$script" "$@" 2>/dev/null)" | ||
| if [ "$got" != "$want" ]; then | ||
| echo "FAIL: scan-result.sh $* -> '$got', want '$want'" | ||
| fails=$((fails + 1)) | ||
| fi | ||
| } | ||
|
|
||
| check clean go 0 | ||
| check vulnerabilities_found go 3 | ||
| for code in 1 2 4 127 137 255 abc ""; do | ||
| check scan_failed go "$code" | ||
| done | ||
|
|
||
| check clean yarn 0 "$completed" | ||
| check vulnerabilities_found yarn 8 "$completed" | ||
| check vulnerabilities_found yarn 16 "$completed" | ||
| check vulnerabilities_found yarn 24 "$completed" | ||
| check vulnerabilities_found yarn 30 "$completed" | ||
| check vulnerabilities_found yarn 31 "$completed" | ||
| check vulnerabilities_found yarn 8 "$failed" | ||
| check vulnerabilities_found yarn 8 "$tmp/missing.txt" | ||
| check vulnerabilities_found yarn 9 "$completed" | ||
| for code in 1 2 4 6 7; do | ||
| check clean yarn "$code" "$completed" | ||
| check scan_failed yarn "$code" "$failed" | ||
| check scan_failed yarn "$code" "$tmp/missing.txt" | ||
| done | ||
| for code in 32 127 137 255 abc ""; do | ||
| check scan_failed yarn "$code" "$completed" | ||
| done | ||
| check scan_failed yarn 1 | ||
| check scan_failed rust 0 | ||
|
|
||
| if [ "$fails" -ne 0 ]; then | ||
| echo "$fails failed" | ||
| exit 1 | ||
| fi | ||
| echo "all passed" |
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 was deleted.
Oops, something went wrong.
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,43 @@ | ||
| # Every commit on a branch must be a conventional commit: release-please builds | ||
| # versions and the changelog from commit subjects. Merge commits are skipped. | ||
| # Same check as the other UnlockEd repos (see docs/repo-standard.md in | ||
| # unlocked-core). | ||
| name: conventional commits | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, edited] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| commits: | ||
| name: conventional commits | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Check commit subjects | ||
| env: | ||
| BASE: ${{ github.event.pull_request.base.sha }} | ||
| HEAD: ${{ github.event.pull_request.head.sha }} | ||
| run: | | ||
| set -euo pipefail | ||
| # the loop reads git log through process substitution, so a bad range would pass silently | ||
| git rev-list "$BASE..$HEAD" > /dev/null | ||
| pattern='^(feat|fix|chore|docs|refactor|test|ci|build|perf|revert|style)(\([a-z0-9._/-]+\))?!?: .+' | ||
| bad=0 | ||
| while IFS= read -r subject; do | ||
| if ! printf '%s' "$subject" | grep -Eq "$pattern"; then | ||
| echo "::error::not a conventional commit: $subject" | ||
| if [[ $subject == 'Revert "'* ]]; then | ||
| inner=${subject#Revert \"} | ||
| echo "::error::reword it to: revert: ${inner%\"}" | ||
| fi | ||
| bad=1 | ||
| fi | ||
| done < <(git log --no-merges --format=%s "$BASE..$HEAD") | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| exit $bad | ||
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
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.
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.