.github/workflows/update_latest.yml #13572
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
schedule: | |
- cron: 44 * * * * | |
workflow_dispatch: | |
inputs: | |
within_days: | |
description: 'Aside from the latest version, how many days back to inspect?' | |
type: number | |
default: 0 | |
jobs: | |
update-latest: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: update_latest | |
outputs: | |
ref: ${{ steps.commit.outputs.ref }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: pip | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Install deps | |
run: pip install -r requirements.txt | |
- run: python inspect_latest.py | |
env: | |
CLEANUP_OLD_IMAGES: "true" | |
if: github.event_name != 'workflow_dispatch' | |
- run: python inspect_latest.py --within-days ${{ github.event.inputs.within_days }} | |
env: | |
CLEANUP_OLD_IMAGES: "true" | |
if: github.event_name == 'workflow_dispatch' | |
- name: Commit and push | |
id: commit | |
run: | | |
if [[ `git status --porcelain` ]]; then | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add . | |
git commit -m "update-latest" | |
git push | |
echo "ref=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | |
else | |
echo "No changes" | |
fi | |
rebuild-site: | |
needs: update-latest | |
uses: ./.github/workflows/webapp.yml | |
with: | |
ref: ${{ needs.update-latest.outputs.ref }} |