forked from garrytan/gstack
-
Notifications
You must be signed in to change notification settings - Fork 0
ci: pin actions to SHA in 8 broken workflows #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
Open
giattijunior
wants to merge
1
commit into
main
Choose a base branch
from
ci/sha-pin-checkout-all-workflows
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
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
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
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,133 @@ | ||
| name: SkillSpector | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - '**/SKILL.md' | ||
| - '.agents/**' | ||
| - '.factory/**' | ||
| - 'AGENTS.md' | ||
| - '**/agents/*.yaml' | ||
| - '**/agents/*.yml' | ||
| - '**/.codex-plugin/plugin.json' | ||
| push: | ||
| branches: [main, master] | ||
| paths: | ||
| - '**/SKILL.md' | ||
| - '.agents/**' | ||
| - '.factory/**' | ||
| - 'AGENTS.md' | ||
| - '**/agents/*.yaml' | ||
| - '**/agents/*.yml' | ||
| - '**/.codex-plugin/plugin.json' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| scan: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff # v6 | ||
|
|
||
| - name: Install SkillSpector | ||
| run: | | ||
| git clone --depth 1 https://github.com/NVIDIA/SkillSpector.git /tmp/SkillSpector | ||
| uv venv .skillspector-venv --python 3.12 | ||
| uv pip install --python .skillspector-venv/bin/python /tmp/SkillSpector | ||
|
|
||
| - name: Scan changed skills | ||
| env: | ||
| EVENT_NAME: ${{ github.event_name }} | ||
| PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} | ||
| BEFORE_SHA: ${{ github.event.before }} | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| if [ "$EVENT_NAME" = "pull_request" ]; then | ||
| BASE_SHA="$PR_BASE_SHA" | ||
| else | ||
| BASE_SHA="$BEFORE_SHA" | ||
| fi | ||
|
|
||
| if [ -z "${BASE_SHA:-}" ] || [ "$BASE_SHA" = "0000000000000000000000000000000000000000" ]; then | ||
| BASE_SHA="$(git rev-list --max-parents=0 HEAD | tail -n 1)" | ||
| fi | ||
|
|
||
| git diff --name-only --diff-filter=ACMR "$BASE_SHA" "$GITHUB_SHA" > /tmp/skillspector-changed.txt | ||
|
|
||
| python3 - <<'PY' | ||
| from pathlib import Path | ||
|
|
||
| repo = Path.cwd() | ||
| changed = (Path("/tmp/skillspector-changed.txt").read_text().splitlines()) | ||
| roots = [] | ||
| seen = set() | ||
|
|
||
| for rel in changed: | ||
| rel = rel.strip() | ||
| if not rel: | ||
| continue | ||
| current = (repo / rel) | ||
| current = current if current.is_dir() else current.parent | ||
|
|
||
| while current != repo.parent and current != current.parent: | ||
| if (current / "SKILL.md").is_file(): | ||
| root = str(current.relative_to(repo)) | ||
| if root not in seen: | ||
| seen.add(root) | ||
| roots.append(root) | ||
| break | ||
| if current == repo: | ||
| break | ||
| current = current.parent | ||
|
|
||
| Path("/tmp/skillspector-targets.txt").write_text("\n".join(roots) + ("\n" if roots else "")) | ||
| print(f"skill_dirs={len(roots)}") | ||
| for root in roots: | ||
| print(root) | ||
| PY | ||
|
|
||
| if [ ! -s /tmp/skillspector-targets.txt ]; then | ||
| echo "No changed skill roots detected; skipping scan." | ||
| exit 0 | ||
| fi | ||
|
|
||
| while IFS= read -r dir; do | ||
| [ -n "$dir" ] || continue | ||
| echo "Scanning $dir" | ||
| ./.skillspector-venv/bin/skillspector scan "$dir" --no-llm --format json --output /tmp/skillspector-report.json | ||
| python3 - <<'PY' | ||
| import json | ||
| import sys | ||
|
|
||
| with open("/tmp/skillspector-report.json", "r", encoding="utf-8") as fh: | ||
| data = json.load(fh) | ||
|
|
||
| findings = data.get("findings", []) | ||
| severities = {str(f.get("severity", "")).upper() for f in findings} | ||
| score = int(data.get("risk_score", 0)) | ||
| blocked = score >= 70 or "CRITICAL" in severities or "HIGH" in severities | ||
|
|
||
| print(f"risk_score={score}") | ||
| print(f"severities={sorted(s for s in severities if s)}") | ||
| print(f"findings={len(findings)}") | ||
|
|
||
| if blocked: | ||
| print("SkillSpector gate failed") | ||
| sys.exit(1) | ||
| PY | ||
| done < /tmp/skillspector-targets.txt |
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.
If this repo is running with the
sha_pinning_required: truepolicy that this change is meant to satisfy, pinning only checkout still leaves the workflow blocked at startup: GitHub documents that with this setting “all actions must be pinned to a full-length commit SHA” (https://docs.github.com/en/enterprise-cloud@latest/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository), but the next step here still usesrhysd/actionlint@v1.7.11by tag. The same partial pinning pattern appears in the other edited workflows, so these runs can continue to fail until alluses:actions are SHA-pinned.Useful? React with 👍 / 👎.