-
Notifications
You must be signed in to change notification settings - Fork 313
50 lines (47 loc) · 1.75 KB
/
issue-label-automation.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
name: issue-label-automation
on:
pull_request_target:
types: [opened]
issues:
types: [opened]
jobs:
automate-labels:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
env:
IS_BOT: ${{ (github.actor == 'dependabot[bot]' || github.actor == 'mergify[bot]') }}
IS_HUMAN: ${{ !(github.actor == 'dependabot[bot]' || github.actor == 'mergify[bot]') }}
steps:
- name: Check if issue or PR was created by external contributor
if: env.IS_HUMAN == 'true' && github.repository_owner == 'celestiaorg'
uses: tspascoal/get-user-teams-membership@v3
id: teamCheck
with:
username: ${{ github.actor }}
team: "celestia-core"
GITHUB_TOKEN: ${{ secrets.PAT_TEAM_CHECK }}
# If an issue was unlabeled add `needs:triage`.
- name: Maybe label issue with `needs:triage`
if: ${{ github.event_name == 'issues' }}
uses: andymckay/labeler@master
with:
add-labels: "needs:triage"
ignore-if-labeled: true
repo-token: ${{ secrets.GITHUB_TOKEN }}
# If an issue or PR was created by someone that isn't part of
# celestia-core, add the `external` label.
- name: Maybe label issue or PR with `external`
if: env.IS_HUMAN == 'true' && steps.teamCheck.outputs.isTeamMember == 'false'
uses: andymckay/labeler@master
with:
add-labels: "external"
repo-token: ${{ secrets.GITHUB_TOKEN }}
# If a PR was created by dependabot or mergify add the `bot` label.
- name: Maybe label PR with `bot`
if: env.IS_BOT == 'true'
uses: andymckay/labeler@master
with:
add-labels: "bot"
repo-token: ${{ secrets.GITHUB_TOKEN }}