File: auto-review.yml

package info (click to toggle)
nsscache 0.49-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 19,664 kB
  • sloc: python: 8,661; xml: 584; sh: 304; makefile: 19
file content (48 lines) | stat: -rw-r--r-- 1,413 bytes parent folder | download
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
# This is a single-maintainer project but I want to require reviews before
# merge, which means that I need a bot to review my own work.
name: Automatic pull request approvals
on:
  pull_request_target:
    types:
      - opened
      - reopened
      - synchronize
      - ready_for_review
  check_suite:
    types:
      - completed
jobs:
  auto-approve:
    runs-on: ubuntu-latest
    if: >
      github.event.pull_request.head.repo.full_name == github.repository &&
      github.event.pull_request.draft == false && (
        github.event.action == 'opened' ||
        github.event.action == 'reopened' ||
        github.event.action == 'synchronize'
      ) && (
        github.actor == 'jaqx0r'
      )
    permissions:
      # wait on check
      checks: read
      # create review
      pull-requests: write
    steps:
      - uses: lewagon/wait-on-check-action@v1.3.1
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          repo-token: ${{ github.token }}
          check-regexp: "test.*"
          wait-interval: 60

      - uses: "actions/github-script@v6"
        with:
          github-token: ${{ github.token }}
          script: |
            await github.rest.pulls.createReview({
              event: "APPROVE",
              owner: context.repo.owner,
              pull_number: context.payload.pull_request.number,
              repo: context.repo.repo,
            })