name: Expedited Release Audit on: push: tags: ['v*'] workflow_dispatch: inputs: tag: description: Release tag to audit required: true type: string permissions: contents: read issues: write jobs: audit: runs-on: ubuntu-latest env: TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }} steps: - name: Checkout # Pinned to an immutable commit: this job holds an issues-write token. uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: fetch-depth: 0 - name: Fetch dev run: git fetch origin dev - name: Audit release path env: GH_TOKEN: ${{ github.token }} ACTOR: ${{ github.actor }} TRIGGER_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} run: | set -euo pipefail # Release App triggers on v*, but only semver tags are releases. # Stray tags (e.g. vffe6fee-dev) must not open audit issues. if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then echo "$TAG is not a semver release tag; skipping" >> "$GITHUB_STEP_SUMMARY" exit 0 fi if git merge-base --is-ancestor "$(git rev-list -n1 "$TAG")" origin/dev; then echo "PR-first release; tag commit is on dev; no action" >> "$GITHUB_STEP_SUMMARY" exit 0 fi existing_issue="$(gh issue list \ --repo "$GITHUB_REPOSITORY" \ --label emergency-change \ --state all \ --search "in:title \"Post-hoc review: $TAG\"" \ --limit 1 \ --json url \ --jq '.[0].url // ""')" if [[ -n "$existing_issue" ]]; then echo "Post-hoc review issue already exists: $existing_issue" >> "$GITHUB_STEP_SUMMARY" exit 0 fi gh label create emergency-change \ --repo "$GITHUB_REPOSITORY" \ --color D93F0B \ --description "Expedited change requiring post-hoc review (SOC 2 evidence)" || true release_runs_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/workflows/release-macos-aarch64.yml?query=branch%3A$TAG" tag_commit="$(git rev-list -n1 "$TAG")" body_file="$RUNNER_TEMP/post-hoc-review.md" cat > "$body_file" <> "$GITHUB_STEP_SUMMARY"