-
Notifications
You must be signed in to change notification settings - Fork 45
26 lines (24 loc) · 1001 Bytes
/
pr-labeler.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
name: PR Test Label Manager
on:
pull_request_target:
branches: [ 'main' ]
types: [ opened, synchronize, reopened ]
jobs:
pr_test_label_manager:
name: PR Test Label Manager
runs-on: ubuntu-latest
if: |
github.event_name == 'pull_request_target' &&
contains(fromJson('["opened", "synchronize", "reopened"]'), github.event.action)
steps:
- name: "Check Membership and Label PR"
uses: actions/github-script@v6
id: check-membership
with:
github-token: ${{ secrets.PR_TOKEN }}
script: |
let prNumber = context.payload.pull_request && context.payload.pull_request.number;
let orgResp = await github.rest.orgs.checkMembershipForUser({org: "viamrobotics", username: context.payload.sender.login});
if (orgResp.status === 204) {
await github.rest.issues.addLabels({owner: "viamrobotics", repo: "docs", issue_number: prNumber, labels: ["safe to build"]});
}