Repository navigation
53 lines (44 loc) · 1.51 KB
/
Copy pathlabeler.yml
File metadata and controls
53 lines (44 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Labeler
on:
workflow_call:
inputs:
configuration-path:
description: "Path to the labeler configuration file"
required: false
type: string
default: ".github/labeler.yml"
permissions:
contents: read
pull-requests: write
jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
# Check if the .github/labeler.yml file exists
- name: Check for labeler configuration
id: labeler-config
env:
GH_TOKEN: ${{ github.token }}
CONFIG_PATH: ${{ github.event.inputs.configuration-path }}
run: |
set -e
if [ -f .github/labeler.yml ]; then
echo "Labeler configuration found"
echo "config=./.github/labeler.yml" >> $GITHUB_STATE
elif [[ -f "$CONFIG_PATH" ]]; then
echo "Labeler configuration found"
echo "config=$CONFIG_PATH" >> $GITHUB_STATE
else
echo "No labeler configuration found"
echo "Downloading configuration file from advanced-security/reusable-workflows repository"
# download file using gh cli
gh api repos/advanced-security/reusable-workflows/contents/.github/labeler.yml -q '.content' | base64 -d > .github/labeler.yml
echo "config=./.github/labeler.yml" >> $GITHUB_STATE
fi
- uses: "actions/labeler@v6"
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: "${{ steps.labeler-config.outputs.config }}"
sync-labels: true