Skip to content

Commit 89fd4fd

Browse files
committed
ci: update workflow
1 parent dbb4318 commit 89fd4fd

File tree

1 file changed

+70
-1
lines changed

1 file changed

+70
-1
lines changed

.github/workflows/pr-autoscan.yml

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ run-name: "⚡ PR › Autoscan"
1313
# ---------------------------------------------------------------------------------------
1414

1515
on:
16-
pull_request:
16+
pull_request_target:
1717
branches:
1818
- main
1919

@@ -57,6 +57,11 @@ env:
5757
jobs:
5858
autocheck-validation:
5959
runs-on: ubuntu-latest
60+
permissions:
61+
id-token: write
62+
contents: read
63+
actions: read
64+
pull-requests: write
6065
steps:
6166

6267
# ---------------------------------------------------------------------------------------
@@ -65,6 +70,70 @@ jobs:
6570
# however this isnt available for 'issue_comment'
6671
# ---------------------------------------------------------------------------------------
6772

73+
- name: 🏷️ Verify Existing Labels
74+
uses: actions/github-script@v7
75+
with:
76+
github-token: ${{ secrets.ADMINSERV_TOKEN_CL || github.token }}
77+
script: |
78+
const labels = JSON.parse( process.env.LABELS_JSON );
79+
for ( const label of labels )
80+
{
81+
try
82+
{
83+
await github.rest.issues.createLabel(
84+
{
85+
owner: context.repo.owner,
86+
repo: context.repo.repo,
87+
name: label.name,
88+
description: label.description || '',
89+
color: label.color
90+
});
91+
}
92+
catch ( err )
93+
{
94+
if ( err.status === 422 )
95+
{
96+
console.log( `Label '${label.name}' already exists. Skipping.` );
97+
}
98+
else
99+
{
100+
console.error( `Error creating label '${label.name}': ${err}` );
101+
}
102+
}
103+
}
104+
105+
- name: 🏷️ Verify Existing Labels
106+
uses: actions/github-script@v7
107+
with:
108+
github-token: ${{ secrets.ADMINSERV_TOKEN_CL || github.token }}
109+
script: |
110+
const labels = JSON.parse( process.env.LABELS_JSON );
111+
for ( const label of labels )
112+
{
113+
try
114+
{
115+
await github.rest.issues.createLabel(
116+
{
117+
owner: context.repo.owner,
118+
repo: context.repo.repo,
119+
name: label.name,
120+
description: label.description || '',
121+
color: label.color
122+
});
123+
}
124+
catch ( err )
125+
{
126+
if ( err.status === 422 )
127+
{
128+
console.log( `Label '${label.name}' already exists. Skipping.` );
129+
}
130+
else
131+
{
132+
console.error( `Error creating label '${label.name}': ${err}` );
133+
}
134+
}
135+
}
136+
68137
# ---------------------------------------------------------------------------------------
69138
# get issue number
70139
# ---------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)