mirror of
https://github.com/jdx/mise-action.git
synced 2026-05-15 14:20:32 +00:00
Resolves all findings exposed by the new zizmor check in PR #471 so the audit can run clean. Verified locally with zizmor v1.24.1 (0 findings, 34 suppressed). - artipacked: add `persist-credentials: false` to every `actions/checkout` step that didn't already set it. - cache-poisoning: pass `cache: false` to mise-action in `ci.yml` (the lint/format job doesn't need a tool cache). - template-injection: in test.yml's checksum_failure job, move `steps.bad.outcome` from inline template into an env var consumed by the shell script. - excessive-permissions: add minimal workflow-level `permissions: contents: read` blocks to ci.yml, test.yml, and test-redacted-env.yml; move release.yml's workflow- level `contents: write` down to the `release` job only, with `enhance-release` getting `contents: read`. postversion.sh now runs `gh auth setup-git` before `git push` — the checkout uses `persist-credentials: false`, so the token isn't in .git/config and raw `git push` would otherwise 403. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
36 lines
1.3 KiB
Bash
Executable file
36 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euxo pipefail
|
|
|
|
VERSION=$(jq -r .version package.json)
|
|
MAJOR_VERSION=$(echo "$VERSION" | cut -d. -f1)
|
|
|
|
# Configure git to use gh's credential helper. The checkout step uses
|
|
# persist-credentials: false (per zizmor's artipacked audit), so the
|
|
# token isn't written to .git/config and raw `git push` would 403.
|
|
gh auth setup-git
|
|
|
|
# create the version tag (allow it to fail if it already exists)
|
|
git tag "v$VERSION" || echo "Tag v$VERSION already exists locally"
|
|
|
|
# push changes to github
|
|
git push
|
|
# push the current tag to github
|
|
git push origin "v$VERSION" || echo "Tag v$VERSION already exists on remote"
|
|
|
|
# set the major version tag to this release
|
|
git tag "v$MAJOR_VERSION" -f
|
|
# push the major version tag to github (retry with pull if it fails)
|
|
if ! git push origin "v$MAJOR_VERSION" -f; then
|
|
echo "Failed to push v$MAJOR_VERSION tag, pulling and retrying..."
|
|
git fetch origin "refs/tags/v$MAJOR_VERSION:refs/tags/v$MAJOR_VERSION" -f
|
|
git tag "v$MAJOR_VERSION" -f
|
|
git push origin "v$MAJOR_VERSION" -f
|
|
fi
|
|
|
|
# check if release already exists before creating
|
|
if gh release view "v$VERSION" >/dev/null 2>&1; then
|
|
echo "Release v$VERSION already exists, skipping creation"
|
|
else
|
|
# create a release on github
|
|
gh release create "v$VERSION" --generate-notes --verify-tag
|
|
fi
|