Skip to content

Increase Data Version #60

Increase Data Version

Increase Data Version #60

name: Increase Data Version
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
update-data-version:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Load data version
id: load_version
run: |
if [ ! -f data_version.txt ]; then
echo "1998" > data_version.txt
fi
year=$(cat data_version.txt)
echo "Current year is: $year"
echo "::set-output name=current::$year"
- name: Check if year is less than 2018 (last available year)
id: check_year
run: |
if [ ${{ steps.load_version.outputs.current }} -ge 2018 ]; then
echo "Year is 2018 or greater. Skipping the workflow."
exit 1
fi
- name: Increase data version
id: increase_version
run: |
year=$((${{ steps.load_version.outputs.current }} + 3))
echo $year > data_version.txt
echo "New year is: $year"
echo "::set-output name=new::$year"
- name: Commit and push updated data version
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add data_version.txt
git commit -m "[Github Action]: Update last year to be taken into account to ${{ steps.increase_version.outputs.new }}"
git push