Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 9ca3f3e

Browse files
committed
ci: add script to sync labels on the repository
1 parent 2fd03ab commit 9ca3f3e

File tree

4 files changed

+49
-0
lines changed

4 files changed

+49
-0
lines changed

.github/update-labels.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
REPO_NAME="iggy-rs/setup-iggy"
4+
API_URL="https://api.github.com/repos/$REPO_NAME/labels"
5+
6+
create_label() {
7+
local name="$1"
8+
local color="$2"
9+
local description="$3"
10+
11+
curl -X POST -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3+json" \
12+
-d '{"name": "'"$name"'", "color": "'"$color"'", "description": "'"$description"'"}' \
13+
"$API_URL"
14+
}
15+
16+
create_label "CI/CD" "93ecdb" "Pull requests bring CI/CD improvements."
17+
create_label "docs" "0075ca" "Improvements or additions to documentation."
18+
create_label "duplicate" "cfd3d7" "This issue or pull request already exists."
19+
create_label "maintenance" "ed4d86" "Maintenance work."
20+
create_label "semver:major" "8151c5" "Label for pull request that brings a major (BREAKING) change."
21+
create_label "semver:minor" "8af85b" "Label for pull request that brings a minor change."
22+
create_label "semver:patch" "fef2c0" "Label for pull request that brings a patch change."

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141

4242
- uses: actions/checkout@v4
4343
with:
44+
fetch-depth: 1
4445
token: ${{ steps.app-token.outputs.token }}
4546
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config
4647
persist-credentials: false

.github/workflows/tag.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919

2020
- uses: actions/checkout@v4
2121
with:
22+
fetch-depth: 1
2223
token: ${{ steps.app-token.outputs.token }}
2324

2425
- name: Update CHANGELOG

.github/workflows/update-labels.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Update repository labels
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
checks:
7+
name: Update labels
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout Repository
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 1
15+
16+
- uses: actions/create-github-app-token@v1
17+
id: app-token
18+
with:
19+
app-id: ${{ secrets.DEPLOY_APP_ID }}
20+
private-key: ${{ secrets.DEPLOY_APP_KEY }}
21+
22+
- name: Call script
23+
env:
24+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
25+
run: .github/update-labels.sh

0 commit comments

Comments
 (0)