-
Notifications
You must be signed in to change notification settings - Fork 159
46 lines (46 loc) · 1.27 KB
/
pr-review-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
name: PR review label
run-name: Review label on PR ${{ github.event.pull_request.number }}
on:
pull_request_target:
types: [labeled]
workflow_dispatch:
inputs:
pr:
description: "PR number"
required: true
env:
PR: ${{ github.event.pull_request.number || inputs.pr }}
permissions:
contents: read
issues: write
pull-requests: write
jobs:
check:
if: github.event.label.name == 'review' || inputs.pr
runs-on: ubuntu-latest
outputs:
url: ${{ steps.get-url.outputs.url }}
pr: ${{ env.PR }}
steps:
- name: Unlabel
if: github.event.pull_request.number
run: |
gh --repo "$GITHUB_REPOSITORY" pr edit "$PR" --remove-label review
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get URL
id: get-url
run: |
URL=$(gh --repo "$GITHUB_REPOSITORY" pr diff $PR | grep '^+' | ruby -e 'puts $stdin.read.scan(/href="([^"]+)"/)')
echo "Found URL: $URL"
echo "url=$URL" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
review:
uses: ./.github/workflows/pr-reviewer.yml
needs:
- check
with:
pr: ${{ needs.check.outputs.pr }}
url: ${{ needs.check.outputs.url }}
secrets: inherit