Skip to content

Update khinsider index #19619

Update khinsider index

Update khinsider index #19619

Workflow file for this run

name: "Update khinsider index"
on:
schedule:
- cron: "0 * * * *"
workflow_dispatch:
jobs:
index-sync:
name: index-sync
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: '${{ secrets.PAT_TOKEN }}'
# See https://github.community/t/push-from-action-even-with-pat-does-not-trigger-action/17622/6
persist-credentials: false
- uses: actions/setup-go@v4
with:
go-version: 1.17.2
- run: go install github.com/marcus-crane/khinsider/v2@v2.0.6
- run: khinsider --debug index
- run: cp ~/.cache/khinsider/index.json .
- name: Commit index changes
env:
# We use a PAT in order to trigger other workflows on commit
# See https://github.community/t/push-from-action-does-not-trigger-subsequent-action/16854/2
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
set -eux
git config --local user.email "helper@utf9k.net"
git config --local user.name "Indexer Bot"
if [[ $(git diff --numstat --minimal | grep index.json | awk '{ print $1 }') == '1' ]]; then
# Only one line difference (the index version incrementing) so bailing out since no changes
exit 0
fi
git add .
git commit -a -m "Index has been updated" || exit 0
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PAT_TOKEN }}
branch: ${{ github.ref }}