Daily broken images check #177
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
name: Daily broken images check | |
on: | |
schedule: | |
# Every Weekday at 8 AM AEDT - https://cron.help/#0_21_*_*_SUN-THU | |
- cron: "0 21 * * SUN-THU" | |
workflow_dispatch: | |
inputs: | |
deploy_url: | |
description: "The URL of the site to test" | |
required: true | |
tests_to_run: | |
description: "The tests to run" | |
required: true | |
create_issue: | |
description: "Create an issue if there are broken images" | |
type: boolean | |
default: true | |
defaults: | |
run: | |
shell: pwsh | |
env: | |
create_issue: ${{ github.event.inputs.create_issue || true }} | |
jobs: | |
check-broken-images: | |
name: Run Playwright Tests | |
uses: ./.github/workflows/template-ui-tests.yml | |
with: | |
deploy_url: ${{ inputs.deploy_url || 'https://www.ssw.com.au' }} | |
tests_to_run: ${{ inputs.tests_to_run || 'images seo-index'}} | |
continue-on-failure: true | |
env-output: | |
name: Env Output | |
runs-on: ubuntu-latest | |
needs: check-broken-images | |
outputs: | |
create_issue: ${{ steps.envs.outputs.create_issue }} | |
steps: | |
- name: Env variables into Output # this is necessary as env variables are not accessible at Job level | |
id: envs | |
shell: pwsh | |
run: | | |
echo "Test passed : ${{ needs.check-broken-images.outputs.testPassed }}" | |
echo "Artifact Id: ${{ needs.check-broken-images.outputs.artifact-id }}" | |
$create_issue='${{ env.create_issue }}' | |
echo "create_issue=$create_issue" >> $env:GITHUB_OUTPUT | |
create-an-issue: | |
name: GitHub Issue | |
runs-on: ubuntu-latest | |
needs: | |
- check-broken-images | |
- env-output | |
if: ${{ needs.env-output.outputs.create_issue == 'true' && needs.check-broken-images.outputs.testPassed == 'false'}} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Create an Issue | |
uses: JasonEtco/create-an-issue@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TITLE: "Broken Images on Homepage" | |
ARTIFACT_ID: ${{ needs.check-broken-images.outputs.artifact-id }} | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
with: | |
filename: .github/ISSUE_TEMPLATE/auto_bug_report.md |