Files
threshing-atlas/.github/workflows/update-sources.yml
T

48 lines
1.6 KiB
YAML

name: Check sources for new data
on:
schedule:
- cron: "23 10 * * *" # daily
workflow_dispatch:
permissions:
contents: write
pull-requests: write
issues: write
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install -r research/python/requirements.txt
- id: check
run: python research/python/update_sources.py --report "$RUNNER_TEMP/report.md"
- name: Rebuild graph and run tests
if: steps.check.outputs.changed == 'true'
run: |
node scripts/build-graph.js
npm test
- name: Open a pull request with the new data
if: steps.check.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v6
with:
branch: data/source-update
delete-branch: true
commit-message: "data: update from community sources"
title: "New data from the community sources"
body-path: ${{ runner.temp }}/report.md
labels: data
- name: Report a broken source link
if: steps.check.outputs.failed != ''
env:
GH_TOKEN: ${{ github.token }}
run: |
title="Source check failed: ${{ steps.check.outputs.failed }}"
if ! gh issue list --state open --search "$title in:title" --json number --jq '.[0].number' | grep -q .; then
gh issue create --title "$title" --body-file "$RUNNER_TEMP/report.md"
fi