-
Notifications
You must be signed in to change notification settings - Fork 11
60 lines (55 loc) · 1.71 KB
/
label-new-language-prs.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
60
name: Auto-Label New Language PRs
on:
pull_request:
branches: [main]
jobs:
compare:
name: Compare Languages
runs-on: ubuntu-latest
outputs:
should-label: ${{ steps.compare.outputs.should-label }}
steps:
- name: Fetch current languages.yaml
uses: actions/checkout@v4
with:
path: old
ref: ${{ github.event.pull_request.base.sha }}
sparse-checkout: gengo/languages.yaml
sparse-checkout-cone-mode: false
clean: false
- name: Fetch updated languages.yaml
uses: actions/checkout@v4
with:
path: new
ref: ${{ github.event.pull_request.head.sha }}
sparse-checkout: gengo/languages.yaml
sparse-checkout-cone-mode: false
clean: false
- name: Checkout scripts
uses: actions/checkout@v4
with:
path: scripts
sparse-checkout: scripts/
sparse-checkout-cone-mode: false
clean: false
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- name: Compare languages
run: (ruby ./scripts/scripts/should-tag-new-language.rb old/gengo/languages.yaml new/gengo/languages.yaml && echo "should-label=true" || echo "should-label=false") >> "$GITHUB_OUTPUT"
id: compare
shell: bash
label:
name: Label PR
runs-on: ubuntu-latest
permissions:
pull-requests: write
needs:
- compare
if: ${{ needs.compare.outputs.should-label == 'true' }}
steps:
- run: gh pr edit $PR_URL --add-label "$PR_LABEL"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
PR_LABEL: new-language