Skip to content

Commit 10194ce

Browse files
committed
ci: ensure upstream labels exist before syncing issues
1 parent 97f65d9 commit 10194ce

File tree

1 file changed

+6
-31
lines changed

1 file changed

+6
-31
lines changed

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

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,6 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v4
1919

20-
- name: Ensure required labels exist
21-
env:
22-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23-
run: |
24-
echo "Creating required labels if they don't exist..."
25-
26-
# Create 'upstream' label
27-
gh label create "upstream" \
28-
--repo "$GITHUB_REPOSITORY" \
29-
--description "Issue synced from upstream C2SP/x509-limbo" \
30-
--color "0E8A16" \
31-
--force || echo "Label 'upstream' already exists or created"
32-
33-
# Create 'needs-triage' label
34-
gh label create "needs-triage" \
35-
--repo "$GITHUB_REPOSITORY" \
36-
--description "Issue needs to be triaged by an agent" \
37-
--color "FBCA04" \
38-
--force || echo "Label 'needs-triage' already exists or created"
39-
4020
- name: Fetch upstream issues
4121
id: fetch
4222
env:
@@ -71,7 +51,6 @@ jobs:
7151
ISSUES_FILE="${{ steps.fetch.outputs.issues_file }}"
7252
CREATED_COUNT=0
7353
SKIPPED_COUNT=0
74-
FAILED_COUNT=0
7554
7655
if [ ! -s "$ISSUES_FILE" ]; then
7756
echo "No issues to process"
@@ -95,6 +74,11 @@ jobs:
9574
if [ -z "$EXISTING" ]; then
9675
echo "Creating issue for upstream #$UPSTREAM_NUM..."
9776
77+
# Ensure tracking label exists in this repository (gh cannot apply non-existent labels)
78+
gh label create "$TRACKING_LABEL" \
79+
--color "ededed" \
80+
--description "Cloned from upstream issue #$UPSTREAM_NUM" >/dev/null 2>&1 || true
81+
9882
# Prepare issue body with upstream reference
9983
ISSUE_BODY="**Upstream Issue:** $UPSTREAM_REPO#$UPSTREAM_NUM
10084
**Created:** $CREATED_AT
@@ -123,8 +107,7 @@ jobs:
123107
echo "✓ Created issue for upstream #$UPSTREAM_NUM"
124108
echo "$CREATE_OUTPUT"
125109
} || {
126-
FAILED_COUNT=$((FAILED_COUNT + 1))
127-
echo "❌ Failed to create issue for upstream #$UPSTREAM_NUM"
110+
echo "⚠ Failed to create issue for upstream #$UPSTREAM_NUM"
128111
echo " gh error:"
129112
echo "$CREATE_OUTPUT"
130113
}
@@ -142,12 +125,4 @@ jobs:
142125
echo "Summary:"
143126
echo "- Created: $CREATED_COUNT new issues"
144127
echo "- Skipped: $SKIPPED_COUNT existing issues"
145-
echo "- Failed: $FAILED_COUNT issues"
146128
echo "- Total processed: ${{ steps.fetch.outputs.issue_count }}"
147-
148-
# Fail the workflow if any issues failed to create
149-
if [ "$FAILED_COUNT" -gt 0 ]; then
150-
echo ""
151-
echo "::error::Failed to create $FAILED_COUNT issue(s). Check logs above for details."
152-
exit 1
153-
fi

0 commit comments

Comments
 (0)