1- name : Upstream Sync
1+ name : Sync Flywheel Upstream
22
33on :
44 schedule :
@@ -72,11 +72,22 @@ jobs:
7272 run : |
7373 git push -f origin "$SYNC_BRANCH"
7474
75+ - name : Ensure Labels Exist
76+ env :
77+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
78+ run : |
79+ # Ensure labels exist to prevent errors during PR creation
80+ gh label create upstream-sync --repo ${{ github.repository }} --description "Syncs changes from upstream" --color 1d76db || true
81+ gh label create conflict --repo ${{ github.repository }} --description "Merge conflicts detected" --color b60205 || true
82+
83+ # Debug: List labels to verify visibility
84+ gh label list --repo ${{ github.repository }}
85+
7586 - name : Create Pull Request
7687 if : steps.merge.outputs.merge_status == 'success' || steps.merge.outputs.merge_status == 'conflict'
7788 run : |
7889 # Check if PR already exists
79- existing_pr=$(gh pr list --head "$SYNC_BRANCH" --base "$TARGET_BRANCH" --json number -q '.[0].number')
90+ existing_pr=$(gh pr list --repo ${{ github.repository }} -- head "$SYNC_BRANCH" --base "$TARGET_BRANCH" --json number -q '.[0].number')
8091
8192 if [[ -z "$existing_pr" ]]; then
8293 echo "Creating new PR..."
91102 fi
92103
93104 PR_URL=$(gh pr create \
105+ --repo ${{ github.repository }} \
94106 --title "$TITLE" \
95107 --body "$BODY" \
96108 --head "$SYNC_BRANCH" \
@@ -104,9 +116,9 @@ jobs:
104116
105117 # Update comments/labels if status changed
106118 if [[ "${{ steps.merge.outputs.merge_status }}" == "conflict" ]]; then
107- gh pr edit "$existing_pr" --title "⚠️ Upstream Sync (Conflicts Detected)" --add-label "conflict" --body "Updates from upstream. Conflicts detected."
119+ gh pr edit "$existing_pr" --repo ${{ github.repository }} -- title "⚠️ Upstream Sync (Conflicts Detected)" --add-label "conflict" --body "Updates from upstream. Conflicts detected."
108120 else
109- gh pr edit "$existing_pr" --title "🔄 Upstream Sync (Clean)" --remove-label "conflict" --body "Updates from upstream. Clean merge."
121+ gh pr edit "$existing_pr" --repo ${{ github.repository }} -- title "🔄 Upstream Sync (Clean)" --remove-label "conflict" --body "Updates from upstream. Clean merge."
110122 fi
111123 fi
112124
0 commit comments