Update Indexes #6
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: Update Indexes | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 */12 * * *' | |
jobs: | |
update-indicadores: | |
name: Update indicadores | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
check-latest: true | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --immutable --immutable-cache --check-cache | |
- name: Update indicadores.json | |
run: yarn update-indexes | |
- name: Checking for changes | |
id: check_changes | |
run: | | |
if git diff --exit-code assets/indicadores.json; then | |
echo "has_changes=false" >> $GITHUB_ENV | |
else | |
echo "has_changes=true" >> $GITHUB_ENV | |
fi | |
- name: Commit and push changes | |
if: ${{ env.has_changes == 'true' }} | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add assets/indicadores.json | |
git commit -m "Update indicadores.json" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |