-
Notifications
You must be signed in to change notification settings - Fork 56
73 lines (62 loc) · 2.52 KB
/
update-getting-started-guide.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Update getting started guide
on:
release:
types: ['released']
pull_request:
branches: ['main', 'release/**']
paths:
# Run workflow on changes to the workflow definition itself to spot check
# the core version update functionality.
- '.github/workflows/update-getting-started-guide.yml'
- 'scripts/update-getting-started-guide-version.sh'
# Run workflow on changes to the getting started guide to validate
# changes to the documentation do not break the update workflow.
- 'docs/getting-started.md'
jobs:
test-update-version:
if: github.event_name == 'pull_request'
runs-on: ubuntu-22.04
permissions:
contents: read
pull-requests: read
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
docs/getting-started.md
scripts/update-getting-started-guide-version.sh
- name: Test update getting started version
run: bash scripts/update-getting-started-guide-version.sh --assert v0.0.0-${{ github.event.pull_request.number }}
update-version:
if: github.event_name == 'release'
runs-on: ubuntu-22.04
permissions:
# Write permissions needed to create pull request.
# Risk is mitigated by seperating jobs such that workflows
# running with write permissions only use code from main.
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
ref: main
sparse-checkout: |
docs/getting-started.md
scripts/update-getting-started-guide-version.sh
- name: Update getting started version
run: bash scripts/update-getting-started-guide-version.sh --verbose ${{ github.event.release.tag_name }}
- name: Create PR
uses: peter-evans/create-pull-request@v7
with:
title: 'Update getting started to ${{ github.event.release.tag_name }}'
commit-message: 'Update getting started to ${{ github.event.release.tag_name }}'
body: |
This PR must be closed and reopened manually to trigger automated checks.
Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request).
labels: easy-to-review, automated-pr
token: ${{ secrets.GITHUB_TOKEN }}
author: "GitHub <[email protected]>"
signoff: true
branch: 'create-pull-request/update-getting-started-version-to-${{ github.event.release.tag_name }}'
base: main
delete-branch: true