From c6251646284b1a0409a8b0fb55b566d07b9b334c Mon Sep 17 00:00:00 2001 From: mrdoodles <19146299+mrdoodles@users.noreply.github.com> Date: Mon, 24 Aug 2026 16:10:12 +0100 Subject: [PATCH] chore: bring this repo up to parity with the other action repos This repository was excluded from a week of org-wide work - a rename, a SHA pin, a Dependabot rollout and a security-documentation pass - because every sweep enumerated repositories from local directories and this one was not cloned. Each of those sweeps reported "all repos verified". A sweep that cannot see a repository reports success, not absence. Five changes: - release.yml becomes publish.yml. This action IS Marketplace-listed, so the listing tracks the release and releasing is how it publishes. Something published nowhere would keep release.yml. - The release is gated on the notes containing a releasable section, matching the headings rather than the "no user-facing changes" sentence, so it fails closed. It prints NO RELEASE CHANGES otherwise. - git-checkout pinned to 90733d3 (v1.1.0) in all five workflows. It is the one action in every repo's required checks, so a bad release to it blocks everything at once. - Dependabot added. Pinning without it is worse than a moving tag - the pin goes stale silently. - CLAUDE.md created. There was none, so the pull_request_target prohibition had nowhere to live. Co-Authored-By: Claude <309050497+MrDClaudeBot@users.noreply.github.com> --- .github/dependabot.yml | 11 +++ .github/workflows/changelog.yml | 2 +- .github/workflows/conventional-validation.yml | 2 +- .github/workflows/lint.yml | 2 +- .../workflows/{release.yml => publish.yml} | 45 +++++++++-- .github/workflows/test.yml | 2 +- CLAUDE.md | 74 +++++++++++++++++++ 7 files changed, 128 insertions(+), 10 deletions(-) create mode 100644 .github/dependabot.yml rename .github/workflows/{release.yml => publish.yml} (54%) create mode 100644 CLAUDE.md diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..39ced50 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + # Conventional prefix so the bump commits read cleanly in CHANGELOG.md. + # Dependabot's branch names cannot satisfy the Conventional Branch spec, so + # conventional validation skips that actor and reports the check as passing. + commit-message: + prefix: "chore(deps)" diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 5953c75..b8564e1 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: lite-actions/git-checkout@v1 + uses: lite-actions/git-checkout@90733d329cd6c632c7597660341002e1a1377c44 # v1.1.0 with: fetch-depth: 0 # release-notes resolves "since the last release" from vX.Y.Z tags, diff --git a/.github/workflows/conventional-validation.yml b/.github/workflows/conventional-validation.yml index 8a35eb5..9eb41c3 100644 --- a/.github/workflows/conventional-validation.yml +++ b/.github/workflows/conventional-validation.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: lite-actions/git-checkout@v1 + uses: lite-actions/git-checkout@90733d329cd6c632c7597660341002e1a1377c44 # v1.1.0 with: fetch-depth: 0 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a07d470..ee891ee 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: lite-actions/git-checkout@v1 + uses: lite-actions/git-checkout@90733d329cd6c632c7597660341002e1a1377c44 # v1.1.0 - name: ShellCheck scripts run: | diff --git a/.github/workflows/release.yml b/.github/workflows/publish.yml similarity index 54% rename from .github/workflows/release.yml rename to .github/workflows/publish.yml index 27e0b81..5a5a28f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,6 @@ -name: Release +name: Publish -# Manual release for the action: generate notes from BREAKING/feat/fix commits +# Manual publish for the action: generate notes from BREAKING/feat/fix commits # since the last release, tag vX.Y.Z, move the vN major tag, and publish a # GitHub Release. Tags are not branch-protected, so no PR/approval dance needed. on: @@ -23,15 +23,15 @@ permissions: contents: write concurrency: - group: release + group: publish cancel-in-progress: false jobs: - release: + publish: runs-on: ubuntu-latest steps: - name: Checkout - uses: lite-actions/git-checkout@v1 + uses: lite-actions/git-checkout@90733d329cd6c632c7597660341002e1a1377c44 # v1.1.0 with: fetch-depth: 0 fetch-tags: true @@ -44,8 +44,29 @@ jobs: to: ${{ github.event.inputs.to }} version: ${{ github.event.inputs.version }} + # Decide from the notes themselves whether there is anything to release. + # Matches the section headings, not the "_No user-facing changes ..._" + # sentence: the headings are a tested contract in release-notes, and + # matching them fails closed - anything unrecognised stops the release. + - name: Check the notes for releasable content + id: gate + shell: bash + env: + NOTES_FILE: ${{ steps.notes.outputs.file }} + run: | + set -euo pipefail + if [ ! -f "${NOTES_FILE}" ]; then + echo "::error::release-notes produced no file at '${NOTES_FILE}'." + exit 1 + fi + if grep -qE '^(\*\*⚠ BREAKING CHANGES\*\*|### Features|### Fixes)$' "${NOTES_FILE}"; then + echo "release=true" >> "${GITHUB_OUTPUT}" + else + echo "release=false" >> "${GITHUB_OUTPUT}" + fi + - name: Tag, move major tag, and publish release - if: steps.notes.outputs.changed == 'true' + if: steps.gate.outputs.release == 'true' env: GH_TOKEN: ${{ github.token }} VERSION: ${{ steps.notes.outputs.version }} @@ -63,3 +84,15 @@ jobs: git push origin -f "${major}" # The generated notes file is the GitHub Release body. gh release create "${tag}" --title "${VERSION}" --notes-file "${NOTES_FILE}" + + - name: No release changes + if: steps.gate.outputs.release != 'true' + shell: bash + run: | + set -euo pipefail + echo "::notice title=NO RELEASE CHANGES::No BREAKING / feat / fix commits since the last release; nothing was tagged or released." + { + echo "## NO RELEASE CHANGES" + echo + echo "No BREAKING / feat / fix commits since the last release." + } >> "${GITHUB_STEP_SUMMARY}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 761dcdd..287611e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: lite-actions/git-checkout@v1 + uses: lite-actions/git-checkout@90733d329cd6c632c7597660341002e1a1377c44 # v1.1.0 - name: Run script tests run: bash tests/test.sh diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..6871fa9 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,74 @@ +# CLAUDE.md + +Guidance for Claude Code (claude.ai/code) working in this repository. + +## Scope + +A composite **GitHub Action** (pure shell) that creates a commit **GitHub +signs**, without a signing key on the runner. Published to the Marketplace as +**Signed Commit Lite**. + +A runner has no signing key, so `git commit` there is unsigned — and a pull +request containing an unsigned commit is blocked outright where signatures are +required. Squashing does not rescue it: GitHub evaluates the PR's commits before +the merge strategy applies. This action commits through GitHub's GraphQL +`createCommitOnBranch`, which signs server-side. + +## Layout + +- `action.yml` — composite action; inputs for branch, message, files, + deleted-files, create-branch, base-sha, expected-head-oid, repository, token. + Output: `commit-sha`. +- `scripts/commit.sh` — all the logic. +- `tests/test.sh` — stubs `gh` on `PATH` to assert the GraphQL payload without + touching the network. + +## Coding style + +- Pure `bash` with `set -euo pipefail`; must pass + `shellcheck -x --severity=warning` (CI enforces). +- Base64 encoding must stay portable: `base64 < "$f" | tr -d '\n'` works on both + macOS and Linux; `base64 -w0` does not exist on macOS. +- Prefer parameter expansion over `sed | head` — SIGPIPE under `pipefail`. + +## Conventions + +- Public repo with a **protected `main`** — all changes go via PR. +- Conventional Commits for messages. **Branch types are a different list from + commit types**: branches allow only `feature bugfix hotfix release chore`, so + `fix/…` and `docs/…` are invalid branch names and a PR's head branch cannot be + renamed. Use `chore/…` when unsure. +- Co-authored commits use the bot identity: + `Co-Authored-By: Claude <309050497+MrDClaudeBot@users.noreply.github.com>` +- **Never use `git worktree`.** Push from the current branch with + `git push origin HEAD:`, or use a fresh clone. +- **Never use `pull_request_target`.** It runs the *base* repository's workflow + with secrets and a write token against fork-controlled code — the classic way + an action repository is compromised. `pull_request` is correct: a fork PR runs + in the fork's context with a read-only token and no access to secrets, so + untrusted code still runs but can neither exfiltrate nor write. This is the + single most important control here and the cheapest to lose by accident, + because `pull_request_target` looks like a convenient way to get a token. + +## Versioning & publishing + +Releases are cut by `publish.yml` (`workflow_dispatch`) — never by hand, and +never through the GitHub web UI: + +```bash +gh workflow run publish.yml --repo lite-actions/signed-commit +``` + +It is `publish.yml`, not `release.yml`, because this action **is** listed: the +Marketplace listing tracks the GitHub Release, so releasing is how it publishes. +Something published nowhere would use `release.yml` instead. + +The workflow computes the version from commits since the last `vX.Y.Z` tag, tags +the release, force-moves `@vN`, and publishes the Release with the generated +notes as its body. It releases nothing when there are no BREAKING/feat/fix +commits, and says `NO RELEASE CHANGES`. + +**Never create a release through the web UI.** The Marketplace checkbox is +required only for an action's *first* publish; afterwards the listing tracks +releases automatically. Using the UI is what produced malformed tags and left +moving major tags stale elsewhere in this org.