fix(ci): skip auto-merge step when lockfile is unchanged
The "Enable auto-merge" step runs unconditionally, even when the lockfile didn't change and no PR exists. This causes the workflow to fail with "lockfile PR was not found." Use a step output to gate the auto-merge step so it only runs when a PR was actually created or updated. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
4
.github/workflows/refresh-lockfile.yml
vendored
4
.github/workflows/refresh-lockfile.yml
vendored
@@ -51,11 +51,13 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Create or update pull request
|
||||
id: upsert-pr
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
if git diff --quiet -- pnpm-lock.yaml; then
|
||||
echo "Lockfile unchanged, nothing to do."
|
||||
echo "pr_created=false" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -79,8 +81,10 @@ jobs:
|
||||
else
|
||||
echo "PR #$existing already exists, branch updated via force push."
|
||||
fi
|
||||
echo "pr_created=true" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Enable auto-merge for lockfile PR
|
||||
if: steps.upsert-pr.outputs.pr_created == 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user