Update screenshots periodically #41
This file contains hidden or 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
| name: Update screenshots periodically | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # Run weekly, at 3:30pm on Monday | |
| # https://cron.help/#30_15_*_*_1 | |
| - cron: '30 15 * * 1' | |
| env: | |
| TESTBED_IMAGE: "ghcr.io/isso-comments/isso-js-testbed:latest" | |
| jobs: | |
| update-screenshots: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Pull testbed from ${{ env.TESTBED_IMAGE }} | |
| run: docker pull ${{ env.TESTBED_IMAGE }} | |
| - name: Build isso-server | |
| run: docker compose build isso-server | |
| - name: Start isso-server | |
| run: docker compose up -d isso-server | |
| - name: Wait for isso-server container to be ready | |
| run: 'for i in $(seq 1 30); do [ "$(docker inspect -f {{.State.Health.Status}} isso-server)" = "healthy" ] && s=0 && break || s=$? && sleep 0.3; done; (exit $s)' | |
| - name: Update screenshots | |
| run: make docker-update-screenshots | |
| env: | |
| TESTBED_IMAGE: ${{ env.TESTBED_IMAGE }} | |
| - name: Check for changes | |
| id: check-changes | |
| run: | | |
| if git diff --quiet isso/js/tests/screenshots/reference/; then | |
| echo "changes=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "changes=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Pull Request | |
| if: steps.check-changes.outputs.changes == 'true' | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| commit-message: "Update reference screenshots" | |
| title: "Update reference screenshots" | |
| body: | | |
| This PR updates the reference screenshots generated by the automated workflow. | |
| Please review the changes to ensure they are expected. | |
| branch: automated-screenshot-update | |
| delete-branch: true |