-
Notifications
You must be signed in to change notification settings - Fork 688
49 lines (42 loc) · 1.63 KB
/
check-prdoc.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
48
49
name: Check PRdoc
on:
pull_request:
types: [labeled, opened, synchronize, unlabeled]
env:
IMAGE: paritytech/prdoc:v0.0.5
API_BASE: https://api.github.com/repos
REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PR: ${{ github.event.pull_request.number }}
MOUNT: /prdoc
ENGINE: docker
jobs:
check-prdoc:
runs-on: ubuntu-latest
steps:
- name: Pull image
run: |
echo "Pulling $IMAGE"
docker pull $IMAGE
docker run --rm $IMAGE --version
- name: Check if PRdoc is required
id: get-labels
run: |
# Fetch the labels for the PR under test
echo "Fetch the labels for $API_BASE/${REPO}/pulls/${GITHUB_PR}"
labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",")
echo "Labels: ${labels}"
echo "labels=${labels}" >> "$GITHUB_OUTPUT"
- name: No PRdoc required
if: ${{ contains(steps.get-labels.outputs.labels, 'R0') }}
run: |
echo "PR detected as silent, no PRdoc is required, exiting..."
exit 0
- name: Checkout repo
if: ${{ !contains(steps.get-labels.outputs.labels, 'R0') }}
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- name: PRdoc check for PR#${{ github.event.pull_request.number }}
if: ${{ !contains(steps.get-labels.outputs.labels, 'R0') }}
run: |
echo "Checking for PR#${GITHUB_PR} in $MOUNT"
$ENGINE run --rm -v $PWD/prdoc:/doc $IMAGE check -n ${GITHUB_PR} || true