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
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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)"
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/conventional-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
45 changes: 39 additions & 6 deletions .github/workflows/release.yml → .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand All @@ -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 }}
Expand All @@ -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}"
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
74 changes: 74 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -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:<branch>`, 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.