Skip to content

Commit

Permalink
adding Ura labels via GHA workflow - do not merge
Browse files Browse the repository at this point in the history
  • Loading branch information
zenmonkeykstop committed Feb 20, 2025
1 parent 35e4b2d commit 618f3ea
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Update repository labels

on:

Check failure on line 3 in .github/workflows/labels.yml

View workflow job for this annotation

GitHub Actions / lint (focal)

3:4 [trailing-spaces] trailing spaces

Check failure on line 3 in .github/workflows/labels.yml

View workflow job for this annotation

GitHub Actions / lint (noble)

3:4 [trailing-spaces] trailing spaces
push:
branches:
- label-add-nomerge
paths:
- '.github/workflows/labels.yml'

jobs:
create-labels:
runs-on: ubuntu-latest
permissions:
issues: write
env:
LABELS_JSON: |
[
{"name": "A11y review needed", "color": "eded8d", "description": ""},
{"name": "A11y review +1", "color": "8ded8d", "description": ""},
{"name": "A11y review -1", "color": "ed8d8d", "description": ""},
{"name": "QA review needed", "color": "eded8d", "description": ""},
{"name": "QA review +1", "color": "8ded8d", "description": ""},
{"name": "QA review -1", "color": "ed8d8d", "description": ""},
{"name": "UX review needed", "color": "eded8d", "description": ""},
{"name": "UX review +1", "color": "8ded8d", "description": ""},
{"name": "UX review -1", "color": "ed8d8d", "description": ""},
{"name": "Visual Design review needed", "color": "eded8d", "description": ""},
{"name": "Visual Design review +1", "color": "8ded8d", "description": ""},
{"name": "Visual Design review -1", "color": "ed8d8d", "description": ""}
]
steps:
- uses: actions/github-script@v7
with:
script: |
const labels = JSON.parse(process.env.LABELS_JSON);
for (const label of labels) {
try {
await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: label.name,
description: label.description || '',
color: label.color
});
} catch (error) {
// Check if the error is because the label already exists
if (error.status === 422) {
console.log(`Label '${label.name}' already exists. Skipping.`);
} else {
// Log other errors
console.error(`Error creating label '${label.name}': ${error}`);
}
}
}

0 comments on commit 618f3ea

Please sign in to comment.