-
Notifications
You must be signed in to change notification settings - Fork 38
50 lines (43 loc) · 2.02 KB
/
release.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
# This workflow will run when a release is created, and automatically update GitHub issue templates
name: GitHub Release
on:
release:
types: [published]
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: 'main' # Otherwise, this action will checkout the tag that was created during publishing
- name: Create branch
id: checkout
run: .github/scripts/checkout.sh update-templates-${{ github.sha }}
- name: Insert release - ${{ github.event.release.tag_name }}
uses: mikefarah/yq@bbdd97482f2d439126582a59689eb1c855944955 #v4.44.3
with:
cmd: |
yq -i '( .body.[] | select(.id == "version") ) ref $x | $x .attributes.options = ["${{ github.event.release.tag_name }}"] + $x .attributes.options' .github/ISSUE_TEMPLATE/bug-report.yml &&
yq -i '( .body.[] | select(.id == "version") ) ref $x | $x .attributes.options = ["${{ github.event.release.tag_name }}"] + $x .attributes.options' .github/ISSUE_TEMPLATE/tck-challenge.yml
- name: Needs updates
id: update
run: echo "update_count=$(git status -s -uno | wc -l)" >> $GITHUB_OUTPUT
- name: Create commit
if: steps.update.outputs.update_count > 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add .github/ISSUE_TEMPLATE/bug-report.yml
git add .github/ISSUE_TEMPLATE/tck-challenge.yml
git commit -m "Update templates to include release ${{ github.event.release.tag_name }}"
git push origin update-templates-${{ github.sha }}
pull-request:
needs: [update]
uses: ./.github/workflows/pull-request.yml
with:
branch: 'update-templates-${{ github.sha }}'
title: 'Update templates to include release ${{ github.event.release.tag_name }}'
body: 'generated pull request'