-
-
Notifications
You must be signed in to change notification settings - Fork 700
59 lines (54 loc) · 1.96 KB
/
auto-label.yml
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
54
55
56
57
58
59
name: "Set Issue Label for issues from main QGIS repo"
on:
issues:
types: [opened]
permissions:
contents: read
jobs:
test:
permissions:
issues: write
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BODY: "${{ github.event.issue.body }}"
MILESTONE: 18 # See https://api.github.com/repos/qgis/QGIS-Documentation/milestones
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- id: find_version_label
name: Find Target version
run: |
LABEL=$(echo "${{ env.BODY }}" | sed -n -r "s/.*QGIS version: ([[:digit:]]\.[[:digit:]]+).*/\1/p")
echo "label: ${LABEL}"
if [[ -n "${LABEL}" ]]; then
echo "label=${LABEL}" >> $GITHUB_OUTPUT
else
echo "no version found so no automatic labeling"
fi
- id: assign_version
name: Assign version Label
if: ${{ steps.find_version_label.outputs.label }}
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["${{ steps.find_version_label.outputs.label }}"]
})
- id: assign_milestone
name: Assign milestone
if: ${{ steps.find_version_label.outputs.label }}
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
github.rest.issues.update({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
milestone: ${{ env.MILESTONE }}
})