Skip to content

Commit 541de0a

Browse files
jpnurmicodex
andcommitted
fix(updater): Trigger CI for new PRs without changelog updates
New updater PRs can end with no branch update after creation when changelog entries are disabled. Amend and push the created PR commit in that case so GitHub emits a pull_request synchronize event. Fixes: #164 Co-Authored-By: OpenAI Codex <noreply@openai.com>
1 parent 43bf14b commit 541de0a

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

updater/action.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,3 +462,32 @@ runs:
462462
Auto-generated by a [dependency updater](https://github.com/getsentry/github-workflows/blob/main/updater/action.yml).
463463
${{ env.TARGET_CHANGELOG }}
464464
labels: dependencies
465+
466+
- name: Trigger PR workflows
467+
if: ${{ ( steps.create-pr.outputs.pull-request-operation == 'created' ) && ( steps.update.outputs.pull-request-head-sha == '' || steps.update.outputs.pull-request-head-sha == steps.create-pr.outputs.pull-request-head-sha ) }}
468+
shell: bash
469+
working-directory: caller-repo
470+
env:
471+
PR_BRANCH: ${{ steps.root.outputs.prBranch }}
472+
PR_HEAD_SHA: ${{ steps.create-pr.outputs.pull-request-head-sha }}
473+
API_TOKEN: ${{ inputs.api-token }}
474+
SSH_KEY: ${{ inputs.ssh-key }}
475+
run: |
476+
git fetch origin "$PR_BRANCH"
477+
git checkout --force -B "$PR_BRANCH" "origin/$PR_BRANCH"
478+
479+
current_head=$(git rev-parse HEAD)
480+
if [ "$current_head" != "$PR_HEAD_SHA" ]; then
481+
echo "::notice::PR branch changed from $PR_HEAD_SHA to $current_head; skipping synthetic CI trigger."
482+
exit 0
483+
fi
484+
485+
git config user.name "github-actions[bot]"
486+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
487+
git commit --amend --no-edit
488+
489+
if [ -n "$API_TOKEN" ] && [ -z "$SSH_KEY" ]; then
490+
git remote set-url origin "https://x-access-token:${API_TOKEN}@github.com/${{ github.repository }}.git"
491+
fi
492+
493+
git push --force-with-lease="refs/heads/$PR_BRANCH:$PR_HEAD_SHA" origin "HEAD:refs/heads/$PR_BRANCH"

0 commit comments

Comments
 (0)