-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
83 lines (75 loc) · 2.39 KB
/
action.yaml
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
74
75
76
77
78
79
80
81
82
83
---
name: Run updatecli and open a PR with changes
author: PrefectHQ
description: This action will run updatecli and push the changes to git and will also open a PR
inputs:
manifest-path:
description: Path to the updatecli manifest file
default: ".github/updatecli/manifest-minor.yaml"
required: true
run-helm-docs:
description: Run helm-docs
default: "false"
required: true
run-type:
description: The type of updatecli run to perform (major or minor)
default: "minor"
required: true
runs:
using: composite
steps:
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
shell: bash
- name: Get current date
run: |
echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
shell: bash
- name: Determine branch name
run: |
echo "BRANCH_NAME=dependency-version-${{ inputs.run-type }}-$DATE" >> $GITHUB_ENV
shell: bash
- name: Create branch for dependency version updates
run: |
git checkout -b $BRANCH_NAME
shell: bash
- name: Install updatecli in the runner
uses: updatecli/[email protected]
- name: Run updatecli in apply mode
run: |
updatecli apply --config ${{ inputs.manifest-path }} --experimental
if [[ $(git diff --name-only | wc -l) -eq 0 ]]; then
echo "No changes detected, exiting"
echo "CHANGES=false" >> $GITHUB_ENV
exit 0
else
echo "CHANGES=true" >> $GITHUB_ENV
fi
git add .
git commit -m $BRANCH_NAME
git push --set-upstream origin $BRANCH_NAME
env:
GITHUB_TOKEN: ${{ github.token }}
shell: bash
- name: Install `helm-docs`
if: inputs.run-helm-docs == 'true' && env.CHANGES == 'true'
uses: jdx/mise-action@v2
with:
install_args: helm-docs
- name: Run `helm-docs`
if: inputs.run-helm-docs == 'true' && env.CHANGES == 'true'
run: |
helm-docs --template-files=README.md.gotmpl
git commit -am "helm-docs"
git push
shell: bash
- name: Create PR
if: env.CHANGES == 'true'
run: |
git checkout $BRANCH_NAME
gh pr create --base main --title $BRANCH_NAME -f --label automated-dependency-updates
env:
GH_TOKEN: ${{ github.token }}
shell: bash