-
Notifications
You must be signed in to change notification settings - Fork 14
42 lines (40 loc) · 1.08 KB
/
auto-approve.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
name: "Auto approve"
on:
pull_request:
branches:
- main
jobs:
changed:
runs-on: ubuntu-latest
name: Get changed metric definition files
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed files in the metrics definitions folder
id: changed-files-specific
uses: tj-actions/changed-files@v34
with:
files: definitions/*.toml
outputs:
any_changed: ${{ steps.changed-files-specific.outputs.any_changed }}
approve:
name: Auto approve PR if no metrics definitions changed
permissions:
pull-requests: write
runs-on: ubuntu-latest
needs: changed
steps:
- uses: actions/github-script@v6
if: needs.changed.outputs.any_changed == 'false'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
event: "APPROVE"
})