Repository navigation
56 lines (54 loc) · 1.75 KB
/
Copy pathprdoc.yml
File metadata and controls
56 lines (54 loc) · 1.75 KB
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
50
51
52
53
54
55
56
name: PRDoc
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: write
pull-requests: write
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Install Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Install changelogger
run: cargo install changelogger-cli --version 0.2.2
- name: Generate PRDoc
id: generate
env:
GH_TOKEN: ${{ github.token }}
run: |
PR_NUM=${{ github.event.pull_request.number }}
PRDOC="prdoc/pr_${PR_NUM}.prdoc"
if [ -f "$PRDOC" ]; then
echo "PRDoc already exists — validating only"
echo "generated=false" >> "$GITHUB_OUTPUT"
else
changelogger prdoc generate --pr "$PR_NUM" --force
echo "generated=true" >> "$GITHUB_OUTPUT"
fi
- name: Validate PRDoc
env:
CI: "true"
run: |
PRDOC="prdoc/pr_${{ github.event.pull_request.number }}.prdoc"
changelogger prdoc validate "$PRDOC"
- name: Validate Backport Rules
if: startsWith(github.base_ref, 'stable') || startsWith(github.base_ref, 'release')
run: |
PRDOC="prdoc/pr_${{ github.event.pull_request.number }}.prdoc"
changelogger prdoc validate --branch "${{ github.base_ref }}" "$PRDOC"
- name: Commit PRDoc
if: steps.generate.outputs.generated == 'true'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Add prdoc for PR #${{ github.event.pull_request.number }} (auto-generated)"
branch: ${{ github.head_ref }}
file_pattern: "prdoc/*.prdoc"