Skip to content

Resources update #19

Resources update

Resources update #19

name: Resources update
on:
workflow_dispatch:
schedule:
# running at 3:00pm on the first day of every month
- cron: '0 15 1 * *'
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@main
- 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 }}