Skip to content

Commit 035437b

Browse files
committed
debug(labels.yml): wip
1 parent 86b7d7e commit 035437b

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

.github/workflows/labels.yml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- main
77
paths:
88
- ".github/workflows/labels.yml"
9+
workflow_dispatch:
910

1011
jobs:
1112
create-labels:
@@ -41,26 +42,11 @@ jobs:
4142
{"name": "timeout:4hrs", "color": "5319E7", "description": "Duration in hours after which the instance will be stopped"}
4243
]
4344
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

0 commit comments

Comments
 (0)