Skip to content

update-events-and-contracts #64368

update-events-and-contracts

update-events-and-contracts #64368

name: update-events-and-contracts
on:
push:
paths:
- "periodicals/*"
- ".github/**"
workflow_dispatch:
#schedule:
# replaced with cloudflare worker triggering this
#
# - cron: '0 15-18,23 * * *'
jobs:
update:
runs-on: ubuntu-latest
defaults:
run:
working-directory: periodicals
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
cache: 'pip'
- name: Install pipenv
run: |
python -m pip install --upgrade pipenv wheel
- id: cache-pipenv
uses: actions/cache@v4
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
pipenv install --deploy --dev
- name: Update events and contracts
run: |
pipenv run python ./updatePeriodicals.py events contracts customeggs
git diff HEAD -- data
env:
EI_USERID: ${{ secrets.EI_USERID }}
- name: Commit, push changes, and possibly trigger new build
run: |
git config user.name 'github-actions'
git config user.email '[email protected]'
git add data/events.json
git diff --cached --quiet || {
git commit -m 'events: update data/events.json (from GitHub Actions)'
git push
# Use a separate personal access token since the token included doesn't seem to trigger
# anything, although the response (HTTP 204) looks all right.
curl -fsS -D- \
-X POST \
-H 'Authorization: Bearer ${{ secrets.WORKFLOW_DISPATCH_TOKEN }}' \
-H 'Accept: application/vnd.github.v3+json' \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/build-wasmegg.yml/dispatches \
-d '{"ref": "'${GITHUB_REF##*/}'"}'
}
git add data/contracts.json
git diff --cached --quiet || {
git commit -m 'contracts: update data/contracts.json (from GitHub Actions)'
git push
# Use a separate personal access token since the token included doesn't seem to trigger
# anything, although the response (HTTP 204) looks all right.
curl -fsS -D- \
-X POST \
-H 'Authorization: Bearer ${{ secrets.WORKFLOW_DISPATCH_TOKEN }}' \
-H 'Accept: application/vnd.github.v3+json' \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/build-eicoops.yml/dispatches \
-d '{"ref": "'${GITHUB_REF##*/}'"}'
}
git add data/customeggs.json
git diff --cached --quiet || {
git commit -m 'custom eggs: update data/customeggs.json (from GitHub Actions)'
git push
# Use a separate personal access token since the token included doesn't seem to trigger
# anything, although the response (HTTP 204) looks all right.
curl -fsS -D- \
-X POST \
-H 'Authorization: Bearer ${{ secrets.WORKFLOW_DISPATCH_TOKEN }}' \
-H 'Accept: application/vnd.github.v3+json' \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/build-eicoops.yml/dispatches \
-d '{"ref": "'${GITHUB_REF##*/}'"}'
curl -fsS -D- \
-X POST \
-H 'Authorization: Bearer ${{ secrets.WORKFLOW_DISPATCH_TOKEN }}' \
-H 'Accept: application/vnd.github.v3+json' \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/build-wasmegg.yml/dispatches \
-d '{"ref": "'${GITHUB_REF##*/}'"}'
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}