forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (45 loc) · 1.48 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
name: Label PRs & Issues
on:
issues:
types: [opened, edited]
pull_request_target:
types: [edited, opened, synchronize, reopened]
jobs:
auto-label-rocm:
runs-on: ubuntu-18.04
steps:
- name: Retrieve information
id: vars
env:
EVENT_NAME: ${{ github.event_name }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_NUMBER: ${{ github.event.pull_request.number }}
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: |
set -eux
if [[ "$EVENT_NAME" == "pull_request_target" ]]; then
TITLE="${PR_TITLE}"
ISSUE_NUMBER="${PR_NUMBER}"
else
TITLE="${ISSUE_TITLE}"
# ISSUE_NUMBER is already set
fi
echo ::set-output name=TITLE::"${TITLE}"
echo ::set-output name=ISSUE_NUMBER::"${ISSUE_NUMBER}"
- name: Auto-label ROCm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TITLE: ${{ steps.vars.outputs.TITLE }}
ISSUE_NUMBER: ${{ steps.vars.outputs.ISSUE_NUMBER }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
run: |
set -eux
if [[ "${TITLE,,}" == *rocm* ]]; then
curl \
-X POST \
-H "Authorization: token ${GITHUB_TOKEN}" \
"https://api.github.com/repos/${OWNER}/${REPO}/issues/${ISSUE_NUMBER}/labels" \
-d '{"labels":["module: rocm"]}'
fi