Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0

- uses: actions/setup-go@v5
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version-file: go.mod

Expand All @@ -28,6 +28,23 @@ jobs:
exit 1
fi

# A tag is mutable: whoever controls it can repoint it at new code that
# runs with this workflow's token. Pinning to a commit SHA is the only
# form GitHub will not silently resolve to something else, so fail if an
# unpinned `uses:` reappears.
- name: actions are pinned to SHAs
run: |
# Only match `uses:` as a YAML step key (optional "- " then uses:),
# so this check's own grep pattern and comments are not scanned.
all_uses="$(grep -rhoE '^[[:space:]]*-?[[:space:]]*uses:[[:space:]]*[^[:space:]]+' .github/workflows/ \
| sed -E 's/.*uses:[[:space:]]*//' | sort -u)"
unpinned="$(printf '%s\n' "$all_uses" | grep -vE '@[0-9a-f]{40}$' || true)"
if [ -n "$unpinned" ]; then
echo "these must be pinned to a full 40-character commit SHA:"
printf '%s\n' "$unpinned"
exit 1
fi

- name: vet
run: go vet ./...

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
outputs:
tag: ${{ steps.pick.outputs.tag }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
fetch-depth: 0 # need all tags to find the latest version

Expand Down Expand Up @@ -60,14 +60,14 @@ jobs:
if: needs.version.outputs.tag != ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
# Build from the tag itself, not the branch head, so the release is
# reproducible even if main moves on while this job runs.
ref: ${{ needs.version.outputs.tag }}
fetch-depth: 0 # full history so release notes can diff against the previous tag

- uses: actions/setup-go@v5
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version-file: go.mod

Expand Down
Loading