Skip to content

Commit 4722aba

Browse files
committed
add sync-labels.yml workflow
1 parent a224b9d commit 4722aba

File tree

3 files changed

+127
-23
lines changed

3 files changed

+127
-23
lines changed

Diff for: .github/labels.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#
2+
# Base
3+
#
4+
5+
- name: "bug"
6+
description: "Something isn't working"
7+
color: "d73a4a"
8+
- name: "documentation"
9+
description: "Improvements or additions to documentation"
10+
color: "0075ca"
11+
- name: "duplicate"
12+
description: "This issue or pull request already exists"
13+
color: "cfd3d7"
14+
- name: "enhancement"
15+
description: "New feature or request"
16+
color: "a2eeef"
17+
- name: "good first issue"
18+
description: "Good for newcomers"
19+
color: "7057ff"
20+
- name: "help wanted"
21+
description: "Extra attention is needed"
22+
color: "008672"
23+
- name: "invalid"
24+
description: "This doesn't seem right"
25+
color: "e4e669"
26+
- name: "question"
27+
description: "Further information is requested"
28+
color: "d876e3"
29+
- name: "wontfix"
30+
description: "This will not be worked on"
31+
color: "ffffff"
32+
33+
#
34+
# Dependabot
35+
#
36+
37+
- name: "dependencies"
38+
description: ""
39+
color: "060266"
40+
- name: "github-actions"
41+
description: "Affected resources are part of some GitHub Actions workflow"
42+
color: "0052cc"

Diff for: .github/workflows/label-sync.yml

-23
This file was deleted.

Diff for: .github/workflows/sync-labels.yml

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# This file is maintained in https://github.com/davorpatech/meta/
2+
name: Synchronize repo labels
3+
4+
on:
5+
push: # when push this files to branches....
6+
branches:
7+
- 'main'
8+
paths:
9+
- '.github/labels.yml' # - definition file
10+
- '.github/workflows/sync-labels.yml' # - this workflow
11+
pull_request: # when pull over this files to branches...
12+
branches:
13+
- 'main'
14+
paths:
15+
- '.github/labels.yml' # - definition file
16+
- '.github/workflows/sync-labels.yml' # - this workflow
17+
workflow_dispatch:
18+
inputs:
19+
dry-run:
20+
type: boolean
21+
description: 'If enabled, changes will not be applied'
22+
required: true
23+
default: true
24+
skip-delete:
25+
type: boolean
26+
description: 'If enabled, labels will not be deleted if not found in YAML file'
27+
required: true
28+
default: true
29+
30+
permissions:
31+
# needed for checkout code
32+
contents: read
33+
#
34+
# Note about permissions in "crazy-max/ghaction-github-labeler"...
35+
# - for list/read labels we need "issues: read". Use in conjunction with "dry-run=true"
36+
# - for a complete CRUD we need "issues: write"
37+
#
38+
# TODO: change scope to "labels: write" when available (see planned https://github.com/community/community/discussions/13565)
39+
#
40+
issues: write
41+
42+
# This allows a subsequently queued workflow run to interrupt/wait for previous runs
43+
concurrency:
44+
group: '${{ github.workflow }}'
45+
cancel-in-progress: false # true = interrupt, false = wait
46+
47+
jobs:
48+
49+
sync:
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v3
54+
55+
- name: Sync (push)
56+
if: github.event_name == 'push'
57+
uses: crazy-max/ghaction-github-labeler@v4
58+
with:
59+
yaml-file: '.github/labels.yml'
60+
dry-run: false # false = apply changes
61+
skip-delete: true # the least destructive case
62+
63+
- name: Sync (PR test)
64+
if: github.event_name == 'pull_request'
65+
uses: crazy-max/ghaction-github-labeler@v4
66+
with:
67+
yaml-file: '.github/labels.yml'
68+
dry-run: true # true = only test
69+
skip-delete: true # the least destructive case
70+
71+
- name: Sync (manual)
72+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.dry-run == 'false'
73+
uses: crazy-max/ghaction-github-labeler@v4
74+
with:
75+
yaml-file: '.github/labels.yml'
76+
dry-run: false # false = apply changes
77+
skip-delete: ${{ github.event.inputs.skip-delete != 'false' }}
78+
79+
- name: Sync (manual test)
80+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.dry-run != 'false'
81+
uses: crazy-max/ghaction-github-labeler@v4
82+
with:
83+
yaml-file: '.github/labels.yml'
84+
dry-run: true # true = only test
85+
skip-delete: ${{ github.event.inputs.skip-delete != 'false' }}

0 commit comments

Comments
 (0)