Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/workflows/advance-staged-qpk-pin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,26 @@ jobs:
if: steps.pr.outputs.number != ''
run: cat staged-pin-summary.md >> "$GITHUB_STEP_SUMMARY"

- name: Queue validated staged pin for merge
- name: Refresh or queue validated staged pin
if: steps.guard.outputs.allowed == 'true'
env:
GH_TOKEN: ${{ secrets.QSL_REPO_SYNC_TOKEN || github.token }}
run: |
set -euo pipefail
merge_state=$(gh pr view "${{ steps.pr.outputs.number }}" \
--repo "$GITHUB_REPOSITORY" --json mergeStateStatus --jq '.mergeStateStatus')
if [ "$merge_state" = "BEHIND" ]; then
gh api --method PUT \
"repos/$GITHUB_REPOSITORY/pulls/${{ steps.pr.outputs.number }}/update-branch" \
-f expected_head_sha="${{ steps.pr.outputs.head_sha }}" >/dev/null
echo "Validated staged pin branch was behind main; requested branch update before merge." \
>> "$GITHUB_STEP_SUMMARY"
exit 0
fi
if [ "$merge_state" != "CLEAN" ]; then
echo "Staged QPK pin is not mergeable yet: $merge_state." >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
gh pr merge "${{ steps.pr.outputs.number }}" \
--repo "$GITHUB_REPOSITORY" \
--auto --rebase --delete-branch \
Expand Down
3 changes: 3 additions & 0 deletions tests/test_update_qpk_pin_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,5 +271,8 @@ def test_staged_pin_auto_advance_is_limited_to_verified_machine_prs() -> None:
assert "candidate_is_not_on_main_history" in workflow
assert "actions/checkout" not in workflow
assert "secrets.QSL_REPO_SYNC_TOKEN || github.token" in workflow
assert "mergeStateStatus" in workflow
assert "/update-branch" in workflow
assert "expected_head_sha" in workflow
assert "--auto --rebase --delete-branch" in workflow
assert "--match-head-commit" in workflow