Merge pull request #14 from ThePorgs/update/1696172483 #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |