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:
parent
035cb8aec2
commit
b05d0c560e
1 changed files with 4 additions and 0 deletions
4
.github/workflows/refresh-lockfile.yml
vendored
4
.github/workflows/refresh-lockfile.yml
vendored
|
|
@ -51,11 +51,13 @@ jobs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Create or update pull request
|
- name: Create or update pull request
|
||||||
|
id: upsert-pr
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
run: |
|
run: |
|
||||||
if git diff --quiet -- pnpm-lock.yaml; then
|
if git diff --quiet -- pnpm-lock.yaml; then
|
||||||
echo "Lockfile unchanged, nothing to do."
|
echo "Lockfile unchanged, nothing to do."
|
||||||
|
echo "pr_created=false" >> "$GITHUB_OUTPUT"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -79,8 +81,10 @@ jobs:
|
||||||
else
|
else
|
||||||
echo "PR #$existing already exists, branch updated via force push."
|
echo "PR #$existing already exists, branch updated via force push."
|
||||||
fi
|
fi
|
||||||
|
echo "pr_created=true" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Enable auto-merge for lockfile PR
|
- name: Enable auto-merge for lockfile PR
|
||||||
|
if: steps.upsert-pr.outputs.pr_created == 'true'
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue