Sub topic 13
Troubleshooting failed or empty releases
This chapter assumes you have built the tag-triggered workflow from earlier chapters. You should be comfortable reading Actions logs, setting permissions, and using gh release create. Most release problems fall into four groups: the workflow never starts, it starts and fails, it succeeds with an empty release, or it succeeds with the wrong content.
Start with the symptom
The workflow never starts
Check these causes in order.
- Tag pattern mismatch.
v*.*.*does not match a tag namedrelease-1.2.0or1.2.0. Compare the tag name with thetagsfilter. - Workflow file missing on the tagged commit. A tag push runs the workflow file as it exists at the tagged commit. If you added the workflow after that commit, the tag does nothing. Delete the tag, commit the workflow, and tag again.
- The tag was created by
GITHUB_TOKEN. Events caused by the built-in token do not start other workflows, apart fromworkflow_dispatchandrepository_dispatch. A tag pushed by another workflow using that token will not trigger your release workflow. Push the tag with a personal access token or a GitHub App token, or put the release step in the same workflow that creates the tag.
The run fails
Read the first error line in the log, not the last.
| Error message | Likely cause | Fix |
|---|---|---|
| `HTTP 403: Resource not accessible by integration` | Token lacks `contents: write` | Add `permissions: contents: write` to the workflow or job |
| `tag ... not found` with `--verify-tag` | The tag was not pushed, or was deleted | Push the tag, then re-run |
| `a release with the same tag name already exists` | A re-run, or a draft created earlier | Use `gh release view` first, or delete the release and re-run |
| `gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable` | `GH_TOKEN` is not set | Add `env: GH_TOKEN: ${{ github.token }}` to the step |
Repository settings can also cap the token. If the default workflow permission is read-only, the permissions block in the file still raises it for that workflow. An organization policy, however, can restrict it further.
The release exists but the notes are empty
Generated notes list merged pull requests between the previous tag and the new one. They come out empty or thin for these reasons:
- Commits were pushed directly to the branch. Only pull requests appear in the list, so direct commits do not.
- Every pull request is excluded. A label in
exclude.labels, or an author listed inexclude.authors, hides it. - No category matches. Without a
"*"catch-all category, pull requests with no matching label are dropped. - The previous tag is wrong. GitHub picks the previous tag by version ordering. A malformed tag such as
v1.2or an old test tag can change the comparison range. Delete stray tags. - The file is in the wrong place. The configuration must be named exactly
.github/release.yml, not.github/release.yamlor.github/workflows/release.yml.
Collect evidence in the run
Add a diagnostic job step before you change anything. This workflow prints the tag list and the release state.
name: Release debug
on:
workflow_dispatch:
permissions:
contents: read
jobs:
inspect:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: List tags newest first
run: git tag --sort=-v:refname | head -n 5
- name: Show latest release
env:
GH_TOKEN: ${{ github.token }}
run: gh release list --limit 3fetch-depth: 0 matters. A default checkout fetches one commit and no history. Any step that runs git describe, git log between tags, or a changelog script then sees nothing or fails with a message about an unknown revision. gh release create --generate-notes does not need local history, because GitHub builds the notes on the server.
Pre-release and asset problems
- A release that is not marked as a pre-release for
v1.3.0-rc.1means the*-*test in your script did not run. Print$GITHUB_REF_NAMEin the log and check it. - An upload that fails with
release not foundmeans the upload step ran before the create step succeeded. Keep both in one job, in order. - A re-run that leaves an old file in place needs
--clobberongh release upload.
Exercise
A teammate's workflow creates the tag v2.0.0 with git push using the default GITHUB_TOKEN, but your tag-triggered release workflow never runs. The tag filter is correct. What is the cause and what are two ways to fix it?
Show answer
Events caused by GITHUB_TOKEN, including tag pushes, do not start other workflows. Fix it by pushing the tag with a personal access token or GitHub App token, or by moving the release steps into the same workflow that creates the tag.