Skip to content

Commit f84aee3

Browse files
authored
Merge pull request #4 from advanced-security/labeler-dynamic
Labeler to auto-download default config file
2 parents cc2fcd6 + a342821 commit f84aee3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/labeler.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ jobs:
2323
# Check if the .github/labeler.yml file exists
2424
- name: Check for labeler configuration
2525
id: labeler-config
26+
env:
27+
GH_TOKEN: ${{ github.token }}
2628
run: |
29+
set -e
2730
if [ -f .github/labeler.yml ]; then
2831
echo "Labeler configuration found"
2932
echo "config=./.github/labeler.yml" >> $GITHUB_STATE
@@ -33,9 +36,12 @@ jobs:
3336
echo "config=${{ github.event.inputs.configuration-path }}" >> $GITHUB_STATE
3437
3538
else
36-
echo "::error::No labeler configuration found"
37-
# Get configuration from current action repository
38-
exit 1
39+
echo "No labeler configuration found"
40+
echo "Downloading configuration file from advanced-security/reusable-workflows repository"
41+
42+
# download file using gh cli
43+
gh api repos/advanced-security/reusable-workflows/contents/.github/labeler.yml -q '.content' | base64 -d > .github/labeler.yml
44+
echo "config=./.github/labeler.yml" >> $GITHUB_STATE
3945
4046
fi
4147

0 commit comments

Comments
 (0)