Skip to content

Commit 87cfd3b

Browse files
committed
fix: update GH_TOKEN to use COPILOT_ISSUE_PR_AGENTIC_WORKFLOW and add step to close stale upstream-sync issues
1 parent 8920715 commit 87cfd3b

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

.github/workflows/weekly-upstream-sync.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
- name: Close previous upstream-sync issues
5757
if: steps.check.outputs.has_changes == 'true'
5858
env:
59-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
GH_TOKEN: ${{ secrets.COPILOT_ISSUE_PR_AGENTIC_WORKFLOW }}
6060
run: |
6161
# Find all open issues with the upstream-sync label
6262
OPEN_ISSUES=$(gh issue list \
@@ -76,10 +76,32 @@ jobs:
7676
--reason "not planned"
7777
done
7878
79+
- name: Close stale upstream-sync issues (no changes)
80+
if: steps.check.outputs.has_changes == 'false'
81+
env:
82+
GH_TOKEN: ${{ secrets.COPILOT_ISSUE_PR_AGENTIC_WORKFLOW }}
83+
run: |
84+
OPEN_ISSUES=$(gh issue list \
85+
--repo "${{ github.repository }}" \
86+
--label "upstream-sync" \
87+
--state open \
88+
--json number \
89+
--jq '.[].number')
90+
91+
for ISSUE_NUM in $OPEN_ISSUES; do
92+
echo "Closing stale issue #${ISSUE_NUM} — upstream is up to date"
93+
gh issue comment "$ISSUE_NUM" \
94+
--repo "${{ github.repository }}" \
95+
--body "No new upstream changes detected. The Java SDK is up to date. Closing."
96+
gh issue close "$ISSUE_NUM" \
97+
--repo "${{ github.repository }}" \
98+
--reason "completed"
99+
done
100+
79101
- name: Create issue and assign to Copilot
80102
if: steps.check.outputs.has_changes == 'true'
81103
env:
82-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
GH_TOKEN: ${{ secrets.COPILOT_ISSUE_PR_AGENTIC_WORKFLOW }}
83105
run: |
84106
COMMIT_COUNT="${{ steps.check.outputs.commit_count }}"
85107
LAST_MERGE="${{ steps.check.outputs.last_merge }}"

0 commit comments

Comments
 (0)