Skip to content

update workflow

update workflow #1

Workflow file for this run

name: update
permissions:
contents: write
on:
schedule:
- cron: '0 0 * * *' # every day
push:
branches:
- main
workflow_dispatch:
jobs:
spider:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11.x"
- run: python3 -m pip install requests
- run: python3 main.py
- name: Commit files
id: commit-files
run: |
if [ -n "$(git status --porcelain database.json)" ]; then
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "$(cat LATEST)"
echo "hasChange=true" >> $GITHUB_OUTPUT
else
echo "No changes detected"
fi
fi
- name: Push changes
uses: ad-m/github-push-action@master
if: ${{ steps.commit-files.outputs.hasChange == 'true' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
trigger_deploy:
needs: spider
runs-on: ubuntu-latest
steps:
- name: Trigger tests
uses: actions/github-script@v6
with:
script: |
const res = await github.rest.repos.createDispatchEvent({
owner: 'jaywcjlove',
repo: 'typenexus',
event_type: 'run-deploy'
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}