-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (49 loc) · 1.84 KB
/
update-examples.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
name: Update Actions Examples
on:
workflow_dispatch:
inputs:
version:
description: 'Version to set all examples to'
required: true
type: string
push:
tags:
- v*
jobs:
call-git-object-name-workflow:
uses: ASFHyP3/actions/.github/workflows/reusable-git-object-name.yml@v0.10.0
upate_actions_examples:
needs: call-git-object-name-workflow
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.TOOLS_BOT_PAK }}
- name: Get version number
env:
INPUT_VERSION: ${{ github.event.inputs.version }}
OBJECT_VERSION: ${{ needs.call-git-object-name-workflow.outputs.name }}
run: |
if [[ -z "${INPUT_VERSION}" ]]; then
echo "ACTIONS_VERSION=${OBJECT_VERSION%%-*}" >> $GITHUB_ENV
else
echo "ACTIONS_VERSION=${INPUT_VERSION%%-*}" >> $GITHUB_ENV
fi
- name: Create update branch
id: update
run: |
git config user.name "tools-bot"
git config user.email "UAF-asf-apd@alaska.edu"
export UPDATE_BRANCH=update-examples-to-${ACTIONS_VERSION}
git switch -c ${UPDATE_BRANCH}
export SEARCH_PATTERN='(ASFHyP3/actions/.github/workflows/.*.yml)@v[0-9]+\.[0-9]+\.[0-9]+'
sed -i -r "s|$SEARCH_PATTERN|\1@${ACTIONS_VERSION}|g" README.md
git commit -am "Bump actions example's version to ${ACTIONS_VERSION}"
git push origin ${UPDATE_BRANCH}
- name: Open PR
env:
PR_TITLE: Update Actions example versions to ${{ env.ACTIONS_VERSION }}
PR_BODY: PR created by a new `v*` tag push event
GH_TOKEN: ${{ secrets.TOOLS_BOT_PAK }}
run: |
gh pr create -t "${PR_TITLE}" -b "${PR_BODY}" -l tools-bot -l bumpless -B develop