Skip to content

Commit 59cf122

Browse files
authored
fix(github): do not skip scheduled labeler runs (#1648)
1 parent 5ffb23a commit 59cf122

2 files changed

Lines changed: 88 additions & 56 deletions

File tree

‎.github/labeler.yml‎

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,79 +2,79 @@
22
"domain:Access":
33
- changed-files:
44
- any-glob-to-any-file:
5-
- "internal/cmd/alb/*"
6-
- "internal/cmd/albwaf/*"
7-
- "internal/cmd/cdn/*"
8-
- "internal/cmd/certificates/*"
9-
- "internal/cmd/loadbalancer/*"
10-
- "internal/cmd/vpn/*"
5+
- "internal/cmd/alb/**"
6+
- "internal/cmd/albwaf/**"
7+
- "internal/cmd/cdn/**"
8+
- "internal/cmd/certificates/**"
9+
- "internal/cmd/loadbalancer/**"
10+
- "internal/cmd/vpn/**"
1111
# runtimes
1212
"domain:Runtimes":
1313
- changed-files:
1414
- any-glob-to-any-file:
15-
- "internal/cmd/ske/*"
16-
- "internal/cmd/scf/*"
17-
- "internal/cmd/edge/*"
15+
- "internal/cmd/ske/**"
16+
- "internal/cmd/scf/**"
17+
- "internal/cmd/edge/**"
1818
# support
1919
# no support domain sdk modules available yet
2020
# central services
2121
"domain:CentralServices":
2222
- changed-files:
2323
- any-glob-to-any-file:
24-
- "internal/cmd/dns/*"
25-
- "internal/cmd/git/*"
26-
- "internal/cmd/intake/*"
27-
- "internal/cmd/kms/*"
28-
- "internal/cmd/kms/*"
29-
- "internal/cmd/logs/*"
30-
- "internal/cmd/modelserving/*"
31-
- "internal/cmd/observability/*"
32-
- "internal/cmd/rabbitmq/*"
33-
- "internal/cmd/redis/*"
34-
- "internal/cmd/opensearch/*"
35-
- "internal/cmd/logme/*"
36-
- "internal/cmd/telemetryrouter/*"
37-
- "internal/cmd/telemetrylink/*"
38-
- "internal/cmd/secretsmanager/*"
39-
- "internal/cmd/dremio/*"
40-
- "internal/cmd/modelexperiments/*"
41-
- "internal/cmd/ufw/*"
42-
- "internal/cmd/workflows/*"
43-
- "internal/cmd/valkey/*"
24+
- "internal/cmd/dns/**"
25+
- "internal/cmd/git/**"
26+
- "internal/cmd/intake/**"
27+
- "internal/cmd/kms/**"
28+
- "internal/cmd/kms/**"
29+
- "internal/cmd/logs/**"
30+
- "internal/cmd/modelserving/**"
31+
- "internal/cmd/observability/**"
32+
- "internal/cmd/rabbitmq/**"
33+
- "internal/cmd/redis/**"
34+
- "internal/cmd/opensearch/**"
35+
- "internal/cmd/logme/**"
36+
- "internal/cmd/telemetryrouter/**"
37+
- "internal/cmd/telemetrylink/**"
38+
- "internal/cmd/secretsmanager/**"
39+
- "internal/cmd/dremio/**"
40+
- "internal/cmd/modelexperiments/**"
41+
- "internal/cmd/ufw/**"
42+
- "internal/cmd/workflows/**"
43+
- "internal/cmd/valkey/**"
4444
# databases
4545
"domain:Databases":
4646
- changed-files:
4747
- any-glob-to-any-file:
48-
- "internal/cmd/mongodbflex/*"
49-
- "internal/cmd/mariadb/*"
50-
- "internal/cmd/sqlserverflex/*"
51-
- "internal/cmd/postgresflex/*"
48+
- "internal/cmd/mongodbflex/**"
49+
- "internal/cmd/mariadb/**"
50+
- "internal/cmd/sqlserverflex/**"
51+
- "internal/cmd/postgresflex/**"
5252
# IaaS
5353
"domain:IaaS":
5454
- changed-files:
5555
- any-glob-to-any-file:
56-
- "internal/cmd/network-area/*"
57-
- "internal/cmd/network/*"
58-
- "internal/cmd/network-interface/*"
59-
- "internal/cmd/public-ip/*"
60-
- "internal/cmd/server/*"
61-
- "internal/cmd/volume/*"
62-
- "internal/cmd/security-group/*"
63-
- "internal/cmd/image/*"
64-
- "internal/cmd/objectstorage/*"
65-
- "internal/cmd/runcommand/*"
66-
- "internal/cmd/serverbackup/*"
67-
- "internal/cmd/serverupdate/*"
68-
- "internal/cmd/sfs/*"
69-
- "internal/cmd/automation/*"
56+
- "internal/cmd/network-area/**"
57+
- "internal/cmd/network/**"
58+
- "internal/cmd/network-interface/**"
59+
- "internal/cmd/public-ip/**"
60+
- "internal/cmd/server/**"
61+
- "internal/cmd/volume/**"
62+
- "internal/cmd/security-group/**"
63+
- "internal/cmd/image/**"
64+
- "internal/cmd/objectstorage/**"
65+
- "internal/cmd/runcommand/**"
66+
- "internal/cmd/serverbackup/**"
67+
- "internal/cmd/serverupdate/**"
68+
- "internal/cmd/sfs/**"
69+
- "internal/cmd/automation/**"
7070
# core platform
7171
"domain:CorePlatform":
7272
- changed-files:
7373
- any-glob-to-any-file:
74-
- "internal/cmd/auditlog/*"
75-
- "internal/cmd/authorization/*"
76-
- "internal/cmd/organization/*"
77-
- "internal/cmd/project/*"
78-
- "internal/cmd/serviceaccount/*"
79-
- "internal/cmd/serviceenablement/*"
80-
- "internal/cmd/cost/*"
74+
- "internal/cmd/auditlog/**"
75+
- "internal/cmd/authorization/**"
76+
- "internal/cmd/organization/**"
77+
- "internal/cmd/project/**"
78+
- "internal/cmd/serviceaccount/**"
79+
- "internal/cmd/serviceenablement/**"
80+
- "internal/cmd/cost/**"

‎.github/workflows/labeler.yaml‎

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,49 @@ on:
88
- cron: '0 * * * *'
99

1010
jobs:
11-
labeler:
11+
# this job runs when the workflow was triggered by the 'pull_request' event
12+
pr-labeler:
1213
permissions:
1314
contents: read
1415
pull-requests: write
1516
issues: write
1617
# don't run on PRs from forks (token has no write permissions)
17-
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
18+
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
1819
name: "Labeler"
1920
runs-on: ubuntu-latest
2021
steps:
2122
- name: Labeler action
2223
uses: actions/labeler@v7
2324
with:
2425
sync-labels: false
26+
27+
# This job runs when the workflow was triggered by the 'workflow_dispatch' or the 'schedule' event.
28+
# This is neccessary because for PRs from forks the default short-lived GitHub token has no write permissions
29+
# and can not add labels to the PR therefore. This means we have to label all PRs from forks using the 'schedule' event.
30+
scheduled-labeler:
31+
permissions:
32+
contents: read
33+
pull-requests: write
34+
issues: write
35+
# don't run on PRs from forks (token has no write permissions)
36+
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
37+
name: "Label all open PRs"
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Fetch open PR numbers
41+
id: fetch-prs
42+
run: |
43+
{
44+
echo 'numbers<<EOF'
45+
gh pr list --repo ${{ github.repository }} --state open --limit 500 --json number --jq '.[].number'
46+
echo EOF
47+
} >> "$GITHUB_OUTPUT"
48+
env:
49+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Labeler action
52+
if: ${{ steps.fetch-prs.outputs.numbers != '' }}
53+
uses: actions/labeler@v7
54+
with:
55+
sync-labels: false
56+
pr-number: ${{ steps.fetch-prs.outputs.numbers }}

0 commit comments

Comments
 (0)