-
Notifications
You must be signed in to change notification settings - Fork 747
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add test prdoc * Prepare for the check * Escape PR number * Fix conditional step * Add checkout and actual check * Cleanup * Minor fixes * Add doumentation * Add more doc
- Loading branch information
Showing
5 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Check PRdoc | ||
|
||
on: | ||
pull_request: | ||
types: [labeled, opened, synchronize, unlabeled] | ||
|
||
env: | ||
# todo: switch to paritytech/prdoc once the container is built & published | ||
# see https://github.com/paritytech/scripts/pull/595 | ||
IMAGE: chevdor/prdoc:v0.0.4 | ||
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@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0 | ||
|
||
- 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 1408 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# This PR does not need a prdoc but it is provided in order to test | ||
title: PRdoc check | ||
|
||
doc: | ||
- audience: Core Dev | ||
description: | | ||
This PRdoc is an **example**. | ||
|
||
This PR brings support and automated checks for documentation in the form of a | ||
[`prdoc`](https://github.com/paritytech/prdoc/) file. | ||
|
||
migrations: | ||
db: [] | ||
|
||
runtime: [] | ||
|
||
crates: [] | ||
|
||
host_functions: [] |