Skip to content

Commit 8fada4a

Browse files
authored
Merge pull request #524 from janhq/ci/fix-upstream-sync
ci: fix upstream-sync repo refs and no-checks handling
2 parents 8168daf + eee4c55 commit 8fada4a

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

.github/workflows/upstream-sync.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
PR_BODY="Updates dev branch with latest release ($LATEST_TAG) from ggml-org/llama.cpp"
8181
8282
gh pr create \
83-
--repo menloresearch/llama.cpp \
83+
--repo ${{ github.repository }} \
8484
--title "$PR_TITLE" \
8585
--body "$PR_BODY" \
8686
--head "$BRANCH_NAME" \
@@ -94,7 +94,7 @@ jobs:
9494
exit 0
9595
fi
9696
97-
PR_NUMBER=$(gh pr list --repo menloresearch/llama.cpp --head "$BRANCH_NAME" --json number --jq '.[0].number')
97+
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --head "$BRANCH_NAME" --json number --jq '.[0].number')
9898
9999
if [[ -z "$PR_NUMBER" ]]; then
100100
echo "Failed to get PR number"
@@ -112,7 +112,10 @@ jobs:
112112
run: |
113113
echo "Waiting for CI checks to complete..."
114114
while true; do
115-
ci_completed=$(gh pr checks $PR_NUMBER --repo menloresearch/llama.cpp --json completedAt --jq '.[].completedAt')
115+
# gh pr checks exits non-zero when checks are pending (8), failing (1),
116+
# or absent (1 "no checks reported"). We inspect the JSON ourselves, so
117+
# don't let those exit codes abort the step under `set -e`.
118+
ci_completed=$(gh pr checks $PR_NUMBER --repo ${{ github.repository }} --json completedAt --jq '.[].completedAt' || true)
116119
117120
# If there are no CI checks, proceed with merge
118121
if [[ -z "$ci_completed" ]]; then
@@ -126,7 +129,7 @@ jobs:
126129
sleep 60
127130
else
128131
echo "CI has completed, checking states..."
129-
ci_states=$(gh pr checks $PR_NUMBER --repo menloresearch/llama.cpp --json state --jq '.[].state')
132+
ci_states=$(gh pr checks $PR_NUMBER --repo ${{ github.repository }} --json state --jq '.[].state' || true)
130133
if echo "$ci_states" | grep -vqE "SUCCESS|SKIPPED"; then
131134
echo "CI failed, exiting..."
132135
echo "SKIP_MERGE=true" >> $GITHUB_ENV
@@ -144,7 +147,7 @@ jobs:
144147
GITHUB_TOKEN: ${{ secrets.PAT_SERVICE_ACCOUNT }}
145148
run: |
146149
echo "Attempting to merge PR #$PR_NUMBER..."
147-
gh pr merge $PR_NUMBER --repo menloresearch/llama.cpp --merge --admin || MERGE_FAILED=$?
150+
gh pr merge $PR_NUMBER --repo ${{ github.repository }} --merge --admin || MERGE_FAILED=$?
148151
149152
if [ ! -z "$MERGE_FAILED" ]; then
150153
echo "Failed to merge PR. Error code: $MERGE_FAILED"

0 commit comments

Comments
 (0)