Skip to content

Commit d187a70

Browse files
author
Ritchie
committed
fix(ci): skip release draft update on pull_request events
The release-drafter action fails with 'Validation Failed: target_commitish' when triggered by pull_request events because it tries to set the PR merge ref (refs/pull/NNN/merge) as the release target_commitish, which GitHub rejects. Add condition so the draft-update step only runs on push to main. The pull_request trigger is kept in the block so the autolabeler still fires for PRs (it runs in a separate step that is unaffected by this condition).
1 parent 7b891bf commit d187a70

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

.github/workflows/release-drafter.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ jobs:
2525
# otherwise, read permission is required at least
2626
pull-requests: write
2727
runs-on: ubuntu-latest
28+
# Only update the release draft on push to main, not on pull_request events.
29+
# Running on PRs causes "Validation Failed: target_commitish" because
30+
# release-drafter tries to set refs/pull/NNN/merge as the release target.
31+
if: github.event_name == 'push'
2832
steps:
2933
# (Optional) GitHub Enterprise requires GHE_HOST variable set
3034
#- name: Set GHE_HOST

0 commit comments

Comments
 (0)