ee389beb8c
- Add 72 rebrand workflow files (polkadot→pezkuwi, substrate→bizinikiwi, cumulus→pezcumulus) - Add GitHub actions, issue templates, and configs - Removed unnecessary workflows (fork-sync, gitspiegel, upstream-tracker, sync-templates, backport) - Renamed zombienet test files to match new naming convention
83 lines
3.1 KiB
YAML
83 lines
3.1 KiB
YAML
name: Check PRdoc
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
# NOTE: prdoc tool from pezkuwichain - using local prdoc check instead
|
|
API_BASE: https://api.github.com/repos
|
|
REPO: ${{ github.repository }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GITHUB_PR: ${{ github.event.pull_request.number }}
|
|
PRDOC_DOC: https://github.com/pezkuwichain/pezkuwi-sdk/blob/main/docs/contributor/prdoc.md
|
|
|
|
jobs:
|
|
check-prdoc:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v4.1.7
|
|
- name: Check prdoc format
|
|
run: |
|
|
# NOTE: pezkuwichain/prdoc Docker image not available for Pezkuwi
|
|
# Using simple file existence and YAML format check instead
|
|
echo "Check prdoc format"
|
|
echo "For PRDoc format, please refer to $PRDOC_DOC"
|
|
|
|
# Check if prdoc directory exists
|
|
if [ -d "prdoc" ]; then
|
|
echo "PRDoc directory found"
|
|
# Simple YAML validation
|
|
for f in prdoc/*.prdoc; do
|
|
if [ -f "$f" ]; then
|
|
echo "Checking: $f"
|
|
python3 -c "import yaml; yaml.safe_load(open('$f'))" || echo "::warning::Invalid YAML in $f"
|
|
fi
|
|
done
|
|
else
|
|
echo "::notice::No prdoc directory found"
|
|
fi
|
|
|
|
- name: Check if PRdoc is required
|
|
if: github.event.pull_request.number != ''
|
|
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: Get Original PR number
|
|
if: ${{ github.event.pull_request.number != '' && !contains(steps.get-labels.outputs.labels, 'R0') }}
|
|
shell: bash
|
|
env:
|
|
PR_TITLE: ${{ github.event.pull_request.title }}
|
|
run: |
|
|
. ./.github/scripts/common/lib.sh
|
|
original_pr_number=''
|
|
|
|
echo "Checking PR title: $PR_TITLE"
|
|
|
|
if [[ "$PR_TITLE" =~ 'Backport' ]]; then
|
|
# Extracting the original PR number from the backport's PR title
|
|
original_pr_number=$(extract_pr_number_from_pr_title "$PR_TITLE")
|
|
echo "Extracted PR number: $original_pr_number"
|
|
else
|
|
original_pr_number=${{ github.event.pull_request.number }}
|
|
fi
|
|
echo "PR_NUMBER=$original_pr_number" >> $GITHUB_ENV
|
|
|
|
- name: Validate prdoc for PR#${{ env.PR_NUMBER }}
|
|
if: ${{ github.event.pull_request.number != '' && !contains(steps.get-labels.outputs.labels, 'R0') }}
|
|
run: |
|
|
echo "Validating PR#${{ env.PR_NUMBER }}"
|
|
python3 --version
|
|
python3 -m pip install cargo-workspace==1.2.1
|
|
python3 .github/scripts/check-prdoc.py Cargo.toml prdoc/pr_${{ env.PR_NUMBER }}.prdoc
|