Move the authenticated drift check into the repository as tools/compat_auth.py, run daily by .github/workflows/compat-auth.yml on the maintainer's forge only. Credentials come from FH_EMAIL and FH_PASSWORD, the output is pass/fail labels only because the run log is public, and a failed run pushes the report to ntfy. Exit 5 means all hold, 10 drift, anything else that it could not run. Point compat.yml, tools/compat.py and the docs at it, add a README section, and cut 0.5.1.
83 lines
3.0 KiB
YAML
83 lines
3.0 KiB
YAML
name: Upstream compatibility
|
|
|
|
# freshharvest.com is a moving target with no API and no stability contract. This
|
|
# integration reads HTML and posts to form endpoints, so a redesign can change
|
|
# what a value MEANS without changing its shape — a sensor quietly reporting last
|
|
# week's total is worse than one that goes unavailable.
|
|
#
|
|
# tools/compat.py records what the integration assumes and asserts it against the
|
|
# live site daily, refreshing the matrix in README.md and opening an issue when
|
|
# something breaks.
|
|
#
|
|
# SCOPE: unauthenticated surface only, so this runs anywhere, the GitHub mirror
|
|
# included. The authenticated contract (dashboard markup, cart hashes, skip
|
|
# popups, subscribe forms) needs a real session: compat-auth.yml checks that
|
|
# half, and runs only on the maintainer's forge, where the account credentials
|
|
# are repository secrets.
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "23 7 * * *" # daily, off the hour
|
|
workflow_dispatch:
|
|
push:
|
|
paths:
|
|
# The manifest of assumptions changed — re-check now, not tomorrow.
|
|
- "tools/compat.py"
|
|
- ".github/workflows/compat.yml"
|
|
|
|
permissions:
|
|
# Read-only on contents: this workflow reports, it does not write to the repo.
|
|
contents: read
|
|
issues: write
|
|
|
|
jobs:
|
|
compat:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.13"
|
|
|
|
- name: Check assumptions against the live site
|
|
id: check
|
|
run: |
|
|
set +e
|
|
python tools/compat.py --markdown > matrix.md
|
|
echo "failures=$?" >> "$GITHUB_OUTPUT"
|
|
cat matrix.md
|
|
|
|
- name: Publish the matrix to the run summary
|
|
run: |
|
|
# Deliberately does NOT commit. GitHub is a read-only mirror of Gitea,
|
|
# so anything a bot pushes here is clobbered by the next sync, and
|
|
# opening a PR needs a repo setting that a mirror should not depend
|
|
# on. The badge should mean "is upstream still compatible", not "did
|
|
# the bot manage its own bookkeeping".
|
|
{
|
|
echo "## Upstream compatibility"
|
|
echo
|
|
cat matrix.md
|
|
} >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
- name: Open an issue when the site has drifted
|
|
if: steps.check.outputs.failures != '0'
|
|
run: |
|
|
TITLE="Upstream drift: freshharvest.com no longer matches our assumptions"
|
|
EXISTING=$(gh issue list --state open --search "$TITLE" --json number -q '.[0].number')
|
|
BODY=$'The daily compatibility check failed. The integration is likely reporting stale or wrong values.\n\n'"$(cat matrix.md)"
|
|
if [ -n "$EXISTING" ]; then
|
|
gh issue comment "$EXISTING" --body "$BODY"
|
|
else
|
|
gh issue create --title "$TITLE" --body "$BODY" --label upstream
|
|
fi
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
|
|
- name: Fail the run on drift
|
|
if: steps.check.outputs.failures != '0'
|
|
run: |
|
|
echo "${{ steps.check.outputs.failures }} assumption(s) no longer hold"
|
|
exit 1
|