-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathupdate-templates-and-cloud-provider-actions.yml
More file actions
74 lines (63 loc) · 2.28 KB
/
Copy pathupdate-templates-and-cloud-provider-actions.yml
File metadata and controls
74 lines (63 loc) · 2.28 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Update Templates And Cloud Provider Actions
on:
schedule:
- cron: '45 15 * * 3'
workflow_dispatch:
jobs:
update-templates-and-actions:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
with:
ref: ${{ github.ref_name }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Generate templates list
run: node scripts/generate-list-of-templates.js
env:
OPENOPS_USERNAME: ${{ secrets.OPENOPS_USERNAME }}
OPENOPS_PASSWORD: ${{ secrets.OPENOPS_PASSWORD }}
- name: Generate cloud provider actions list
run: node scripts/generate-lists-of-cloud-provider-actions.js
- name: Check for changes
id: changes
run: |
if git status --porcelain | grep .; then
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "No changes detected. Exiting successfully."
fi
- name: Create update branch
id: branch
if: steps.changes.outputs.changed == 'true'
run: |
TS=$(date -u +"%Y-%m-%d-%H-%M")
BRANCH="updated-templates-and-actions-$TS"
echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"
git checkout -b "$BRANCH"
- name: Commit and push changes
if: steps.changes.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Templates and cloud provider actions updated as of $(date -u +'%Y-%m-%d')"
git push origin HEAD
- name: Create pull request
if: steps.changes.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--head "${{ steps.branch.outputs.branch }}" \
--base "${{ github.ref_name }}" \
--title "Update templates and cloud provider actions" \
--body "Automated update of templates and cloud provider actions." \
--reviewer marco-comi-openops