Auto update the data set #55
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: Auto update the data set | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "13 13 13 * *" # on 13:13 of the 13th of every month | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
diff-and-raise-pr: | |
name: Find diff and raise PR if there is a data change | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.0" | |
- name: Install jq | |
uses: dcarbone/[email protected] | |
- name: Run update script | |
run: sh refresh_data.sh | |
- name: Check git status | |
id: git_check | |
run: | | |
echo "FILES_CHANGED<<EOF" >> $GITHUB_ENV | |
git status --porcelain -s -uall >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Print git status | |
run: echo "${{ env.FILES_CHANGED }}" | |
- name: Check date | |
id: date_check | |
run: echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Print date | |
run: echo "${{ env.DATE }}" | |
- name: Create Pull Request | |
if: env.FILES_CHANGED != '' | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
commit-message: "chore: data update on ${{ env.DATE }}" | |
committer: "akshaybhalotia <[email protected]>" | |
branch: "chore/data-update-${{ env.DATE }}" | |
delete-branch: true | |
base: main | |
title: "data update: ${{ env.DATE }}" | |
body: "Automated data update by GitHub action" | |
reviewers: "akshaybhalotia" | |
assignees: "akshaybhalotia" |