I have this workflow in a monorepo (frontend / backend / automated tests) that runs for every pull request. I want to not deploy frontend/backend when just making changes to Cypress tests so I have added path-ignore
which works. However, now pull requests with just changes only changes in those path-ignore
folders get blocked by the following:
Questions E2E Test / build-and-test Expected — Waiting for status to be reported
This is the code at the end of E2E workflow, even though it doesn’t run it still somehow expects a status:
- name: Check for Report Files
id: check_report
run: |
if [ -f backend/reports/junit.xml ]; then
echo "report_exists=true" >> $GITHUB_ENV
else
echo "report_exists=false" >> $GITHUB_ENV
fi
- name: Upload Report to artifacts
uses: actions/upload-artifact@v3
if: env.report_exists == 'true'
with:
name: e2e-report.${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
path: backend/reports/junit.xml
- name: Clear connection
if: success() || failure()
run: |
pkill -9 -f start-iap-tunnel
- name: Test Report
id: e2e_test_report
uses: dorny/test-reporter@v1
if: env.report_exists == 'true'
with:
name: Questions E2E Tests
path: backend/reports/*.xml
reporter: jest-junit
- name: Notify on PR
if: github.event_name == 'pull_request' && (success() || failure()) && steps.e2e_test_report.outputs.url_html != ''
uses: actions/github-script@v6
with:
script: |
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `### E2E Questions test report overview
| Passed ✅ | Failed ❌ | Skipped |
| ------------- |:-------------:| -------:|
| ${{ steps.e2e_test_report.outputs.passed }} | ${{ steps.e2e_test_report.outputs.failed }} | ${{ steps.e2e_test_report.outputs.skipped }} |
**Report link:** ${{ steps.e2e_test_report.outputs.url_html }}
`
});
And here is the pull request workflow:
on:
pull_request:
branches:
- main
paths-ignore:
- '.github/**'
- 'cypress-tests/**'
- 'api-tests/**'
jobs:
questions-e2e-test:
name: Questions E2E Test
uses: ./.github/workflows/job-questions-e2e-test.yml
with:
WORKLOAD_IDENTITY_PROVIDER_DEV: ${{ vars.WORKLOAD_IDENTITY_PROVIDER_DEV }}
SERVICE_ACCOUNT_DEV: ${{ vars.SERVICE_ACCOUNT_DEV }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
deploy-preview-backend:
name: Deploy backend preview
uses: ./.github/workflows/backend-deploy-preview.yml
with:
WORKLOAD_IDENTITY_PROVIDER_DEV: ${{ vars.WORKLOAD_IDENTITY_PROVIDER_DEV }}
SERVICE_ACCOUNT_DEV: ${{ vars.SERVICE_ACCOUNT_DEV }}
DEPLOY_CHANNEL_ID_DEV: ${{ github.head_ref == 'pentest' && 'pentest' || format('pr{0}', github.event.pull_request.number) }}
deploy-preview-frontend:
name: Deploy frontend preview
uses: ./.github/workflows/frontend-deploy-preview.yml
with:
WORKLOAD_IDENTITY_PROVIDER_DEV: ${{ vars.WORKLOAD_IDENTITY_PROVIDER_DEV }}
SERVICE_ACCOUNT_DEV: ${{ vars.SERVICE_ACCOUNT_DEV }}
DEPLOY_CHANNEL_ID_DEV: ${{ github.head_ref == 'pentest' && 'pentest' || format('pr{0}', github.event.pull_request.number) }}
send-message:
needs: [deploy-preview-frontend, deploy-preview-backend]
runs-on: ubuntu-latest
if: ${{ always() && contains(needs.*.result, 'success') && !(contains(needs.*.result, 'failure')) && !(contains(needs.*.result, 'cancelled')) }}
steps:
- uses: actions/checkout@v4
- name: Notify pull request
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: ${{ github.event.pull_request.number }},
owner: context.repo.owner,
repo: context.repo.repo,
body: `Deployed to ${{ format('https://{0}.preview.dev', format('pr{0}', github.event.pull_request.number)) }}`
})