-
Notifications
You must be signed in to change notification settings - Fork 1.2k
60 lines (59 loc) · 2.1 KB
/
pr-labeler.yml
File metadata and controls
60 lines (59 loc) · 2.1 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
54
55
56
57
58
59
60
name: "Pull Request Labeler"
on:
pull_request_target:
types: [opened]
jobs:
apply-file-based-labels:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v6
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
apply-internal-external-label:
needs: apply-file-based-labels
if: ${{ always() }}
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Apply internal/external label
id: label_step
uses: actions/github-script@v8
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const maintainers = [
'aws-sam-cli-bot',
'seshubaws', 'valerena',
'Vandita2020', 'roger-zhangg',
'vicheey', 'bnusunny', 'tobixlea',
'reedham-aws', 'licjun', 'dependabot[bot]'
];
if (maintainers.includes(context.payload.sender.login)) {
await github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['pr/internal']
});
core.setOutput("external", "false");
} else {
await github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['pr/external', 'stage/needs-triage']
});
core.setOutput("external", "true");
}
- name: Send Slack Notification for External PR
if: steps.label_step.outputs.external == 'true'
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_TITLE: 'PR Created: ${{ github.event.pull_request.title }} by ${{ github.event.pull_request.user.login }}'
SLACK_FOOTER: ''
MSG_MINIMAL: true
SLACK_MESSAGE: '${{ github.event.pull_request.html_url }}'