Skip to content

Commit c0a3104

Browse files
author
Ritchie
committed
fix(ci): skip release-drafter on pull_request events
The release-drafter action runs on both push (main) and pull_request events. When triggered by a PR, it attempts to update the draft release with the PR merge ref (refs/pull/N/merge) as target_commitish, which the GitHub Releases API rejects with a 422 validation error. Fix: add condition to the job so the draft release is only updated when commits land on main. The PR trigger is still listed in the workflow triggers for the autolabeler feature — it will simply be skipped at the job level. Fixes recurring failures: runs 23481318939, 23369773059, 23369768998, 23111592904 (all 'invalid target_commitish' errors).
1 parent 684ee68 commit c0a3104

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

.github/workflows/release-drafter.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ permissions:
1818

1919
jobs:
2020
update_release_draft:
21+
# Only update the release draft on push to main.
22+
# On pull_request events the action would try to set target_commitish to
23+
# the PR merge ref (refs/pull/N/merge), which the GitHub Releases API
24+
# rejects with a 422 "Validation Failed: invalid target_commitish" error.
25+
if: github.event_name == 'push'
2126
permissions:
2227
# write permission is required to create a github release
2328
contents: write

0 commit comments

Comments
 (0)