|
| 1 | +--- |
| 2 | +description: | |
| 3 | + Automated release agent for this repository. Runs weekly to create a |
| 4 | + release PR with release notes from git history since the last release. |
| 5 | + The PR requires human review and approval before merge. When merged, |
| 6 | + a separate workflow creates the GitHub release with the tag. |
| 7 | +
|
| 8 | +on: |
| 9 | + schedule: weekly on monday |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + issues: read |
| 15 | + pull-requests: read |
| 16 | + |
| 17 | +model: claude-sonnet-4-5-20250929 |
| 18 | +engine: |
| 19 | + id: claude |
| 20 | +tools: |
| 21 | + bash: ["*"] |
| 22 | + github: |
| 23 | + toolsets: [default] |
| 24 | + |
| 25 | +safe-outputs: |
| 26 | + github-app: |
| 27 | + client-id: ${{ vars.GH_AW_APP_CLIENT_ID }} |
| 28 | + private-key: ${{ secrets.GH_AW_APP_PRIVATE_KEY }} |
| 29 | + create-pull-request: |
| 30 | + max: 1 |
| 31 | + branch-prefix: release/ |
| 32 | + allowed-files: |
| 33 | + - RELEASE-NOTES.md |
| 34 | + noop: |
| 35 | + missing-data: |
| 36 | +--- |
| 37 | + |
| 38 | +# Release Agent |
| 39 | + |
| 40 | +This workflow runs weekly to create a release PR. |
| 41 | + |
| 42 | +## Your task |
| 43 | + |
| 44 | +1. **Check for existing release PRs**: Before doing anything else, run |
| 45 | + `gh pr list --label release --state open --json number --jq length` |
| 46 | + to check if a release PR is already open. If the count is non-zero, |
| 47 | + use `noop` to report that a release PR is already open. |
| 48 | + |
| 49 | +2. **Fetch full history**: The checkout is shallow by default. Run |
| 50 | + `git fetch --unshallow --tags` so that all tags and commit history |
| 51 | + are available. |
| 52 | + |
| 53 | +3. **Determine the next version**: Run `scripts/next-version.sh` to get |
| 54 | + the next version string (e.g., `v0.3.0`). |
| 55 | + |
| 56 | +4. **Generate release notes**: Use GitHub's release notes generation API |
| 57 | + as a starting point: |
| 58 | + ```bash |
| 59 | + gh api repos/$GITHUB_REPOSITORY/releases/generate-notes \ |
| 60 | + -f tag_name="<next-version>" \ |
| 61 | + -f previous_tag_name="<last-tag>" \ |
| 62 | + --jq .body |
| 63 | + ``` |
| 64 | + Then refine the output: group changes by category (Features, Bug Fixes, |
| 65 | + Documentation, Dependencies, Other), add a brief summary at the top, |
| 66 | + and highlight any breaking changes. |
| 67 | + |
| 68 | +5. **Write RELEASE-NOTES.md**: Write the final release notes to |
| 69 | + `RELEASE-NOTES.md` at the repository root. This file is overwritten |
| 70 | + each release. |
| 71 | + |
| 72 | +6. **Create the release PR**: Use the `create-pull-request` safe-output |
| 73 | + with: |
| 74 | + - **Title**: `Release <version>` (e.g., "Release v0.3.0") |
| 75 | + - **Branch**: `<version>` (e.g., "v0.3.0") — the `release/` prefix |
| 76 | + is added automatically by the branch-prefix setting |
| 77 | + - **Body**: The release notes from RELEASE-NOTES.md |
| 78 | + - **Labels**: `release` |
| 79 | + |
| 80 | +7. **Handle edge cases**: |
| 81 | + - If there are no changes since the last release, use `noop` |
| 82 | + - If you cannot determine the version or history, use `missing-data` |
| 83 | + |
| 84 | +## Constraints |
| 85 | + |
| 86 | +- Never push directly to the default branch |
| 87 | +- Only modify RELEASE-NOTES.md — do not touch other files |
| 88 | +- Always include "Generated-by: AI" in the PR body |
| 89 | +- Require human review for all releases |
0 commit comments