Skip to content

Commit a7cc2f2

Browse files
committed
here goes nothing
1 parent b64e752 commit a7cc2f2

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed

.github/labels.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
labels:
2+
- name: "bug"
3+
color: "#d73a4a"
4+
description: "Something isn't working"
5+
- name: "documentation"
6+
color: "#0075ca"
7+
description: "Improvements or additions to documentation"
8+
- name: "duplicate"
9+
color: "#cfd3d7"
10+
description: "This issue or pull request already exists"
11+
- name: "enhancement"
12+
color: "#a2eeef"
13+
description: "New feature or request"
14+
- name: "help wanted"
15+
color: "#008672"
16+
description: "Extra attention is needed"
17+
- name: "question"
18+
color: "#d876e3"
19+
description: "Further information is requested"
20+
- name: "wontfix"
21+
color: "#ffffff"
22+
description: "This will not be worked on"
23+
- name: "Mcity"
24+
color: "#CED453"
25+
description: "This particularly affects Mcity testing"
26+
- name: "Kcity"
27+
color: "#3E508D"
28+
description: "This particularly affects Kcity testing"
29+
- name: "Simulation"
30+
color: "#DB4C81"
31+
description: "This particularly affects simulation testing"
32+
- name: "Localization"
33+
color: "#6F3CFD"
34+
description: "This particularly affects the localization challenge"
35+
- name: "99BOR"
36+
color: "#D0C35B"
37+
description: "This particularly affects the 99% buy off ride challenge (99BOR)"
38+
- name: "DYOC"
39+
color: "#1AB65E"
40+
description: "This particularly affects the design your own challenge (DYOC)"
41+
- name: "Safety Concern"
42+
color: "#FBCA04"
43+
description: "This poses a safety risk"
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Update Labels Across All Repos in Org
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- .github/labels.yml # Only trigger if the label configuration changes
9+
10+
jobs:
11+
update-labels:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout the repository
15+
uses: actions/checkout@v4
16+
17+
- name: Set up GitHub Token for API Authentication
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.x'
21+
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install requests yq
26+
27+
- name: Get all repos in the organization
28+
id: get_repos
29+
run: |
30+
ORGANIZATION="queens-autodrive" # Replace with your organization name
31+
REPOS=$(curl -s \
32+
-H "Authorization: token $GITHUB_TOKEN" \
33+
"https://api.github.com/orgs/$ORGANIZATION/repos?per_page=100" \
34+
| jq -r '.[].name')
35+
echo "REPOS=$REPOS" >> $GITHUB_ENV # Set repos as an environment variable for later use
36+
37+
- name: Update Labels for All Repos
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub token for authentication
40+
run: |
41+
LABELS=$(cat .github/labels.yml) # Path to your labels configuration file
42+
43+
# Loop through the repositories listed in the environment variable
44+
for REPO in $REPOS; do
45+
echo "Updating labels in $REPO"
46+
47+
# Loop through the labels and update them
48+
for LABEL in $(echo "$LABELS" | yq e '.labels[]' -); do
49+
# Extract label name and color from the YAML file
50+
LABEL_NAME=$(echo "$LABEL" | yq e '.name' -)
51+
LABEL_COLOR=$(echo "$LABEL" | yq e '.color' -)
52+
LABEL_DESCRIPTION=$(echo "$LABEL" | yq e '.description' -)
53+
54+
echo "Label: $LABEL_NAME, Color: $LABEL_COLOR, Description: $LABEL_DESCRIPTION" # Print label info
55+
56+
# Make the API request to update the label
57+
curl -X PUT \
58+
-H "Authorization: token $GITHUB_TOKEN" \
59+
-H "Accept: application/vnd.github.v3+json" \
60+
-d '{"name": "'"$LABEL_NAME"'", "color": "'"$LABEL_COLOR"'"}' \
61+
"https://api.github.com/repos/$ORGANIZATION/$REPO/labels/$LABEL_NAME"
62+
done
63+
done

0 commit comments

Comments
 (0)