-
Notifications
You must be signed in to change notification settings - Fork 1k
47 lines (47 loc) · 1.69 KB
/
maintenance_bot.yaml
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: Maintenance Bot
on:
pull_request_target:
types: [opened, reopened, edited, ready_for_review, unlabeled]
jobs:
labeler:
name: Assign labels and milestone
if: github.repository_owner == 'galaxyproject'
runs-on: ubuntu-latest
env:
MILESTONE_NUMBER: 21
steps:
- name: Get latest pull request labels
id: get_pr_labels
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const response = await github.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
console.log(response);
return response.data;
- name: Add area labels
if: ${{ ! contains(join(fromJSON(steps.get_pr_labels.outputs.result).*.name, ', '), 'area/') }}
uses: actions/labeler@main
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Assign milestone
if: |
! github.event.pull_request.milestone &&
! contains(github.event.pull_request.labels.*.name, 'merge') &&
! contains(github.event.pull_request.labels.*.name, 'status/WIP') &&
! contains(github.event.pull_request.title, 'WIP') &&
! github.event.pull_request.draft
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
milestone: ${{ env.MILESTONE_NUMBER }},
});