-
Notifications
You must be signed in to change notification settings - Fork 14
50 lines (48 loc) · 1.59 KB
/
update_resources.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
name: Resources update
on:
workflow_dispatch:
schedule:
# running at 3:00pm on the first day of every month
- cron: '0 15 1 * *'
push:
paths-ignore:
- ".github/**"
- "**.md"
jobs:
init:
name: Initialize
runs-on: ubuntu-latest
outputs:
BRANCH_NAME: ${{ steps.varset.outputs.BRANCH_NAME }}
steps:
- name: Setting variables
id: varset
run: |
echo "BRANCH_NAME=update/$(date +%s)" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
update:
needs: init
name: Updating resources
runs-on: ubuntu-latest
steps:
- name: Checkout resources repo
uses: actions/checkout@v3
- name: Create new local branch from timestamp
run: git checkout -b ${{ needs.init.outputs.BRANCH_NAME }}
- name: Update resources
# TODO: need to improve that, make unit tests, etc.
run: ./update-resources.sh
- name: Staging changes
run: git add --all
- name: Configuring git identity
run: |
git config --local user.name "Github Actions"
git config --local user.email "actions@github.com"
- name: Committing changes
run: git commit -m "updating resources"
- name: Pushing new branch
run: git push --set-upstream origin ${{ needs.init.outputs.BRANCH_NAME }}
- name: Creating pull request
run: gh pr create --base "main" --head "${{ needs.init.outputs.BRANCH_NAME }}" --title "Resources update $(date '+%d-%b-%y')" --body 'Created by GitHub Action' --label "bot"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}