File tree Expand file tree Collapse file tree 1 file changed +9
-23
lines changed Expand file tree Collapse file tree 1 file changed +9
-23
lines changed Original file line number Diff line number Diff line change 6
6
- main
7
7
paths :
8
8
- " .github/workflows/labels.yml"
9
+ workflow_dispatch :
9
10
10
11
jobs :
11
12
create-labels :
@@ -41,26 +42,11 @@ jobs:
41
42
{"name": "timeout:4hrs", "color": "5319E7", "description": "Duration in hours after which the instance will be stopped"}
42
43
]
43
44
steps :
44
- - uses : actions/github-script@v7
45
- with :
46
- script : |
47
- const labels = JSON.parse(process.env.LABELS_JSON);
48
- for (const label of labels) {
49
- try {
50
- await github.rest.issues.createLabel({
51
- owner: context.repo.owner,
52
- repo: context.repo.repo,
53
- name: label.name,
54
- description: label.description || '',
55
- color: label.color
56
- });
57
- } catch (error) {
58
- // Check if the error is because the label already exists
59
- if (error.status === 422) {
60
- console.log(`Label '${label.name}' already exists. Skipping.`);
61
- } else {
62
- // Log other errors
63
- console.error(`Error creating label '${label.name}': ${error}`);
64
- }
65
- }
66
- }
45
+ - name : Create or Update Labels
46
+ run : |
47
+ echo $LABELS_JSON | jq -r '.[] | [.name, .color, .description] | @tsv' | \
48
+ while IFS=$'\t' read -r name color description; do
49
+ echo "name [${name}]"
50
+ echo "color [${color}]"
51
+ echo "description [${description}]"
52
+ done
You can’t perform that action at this time.
0 commit comments