|
| 1 | +name: Pull Request Validation |
| 2 | + |
| 3 | +on: pull_request |
| 4 | + |
| 5 | +permissions: { } |
| 6 | + |
| 7 | +jobs: |
| 8 | + identify-target-environment: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + permissions: |
| 11 | + contents: read |
| 12 | + outputs: |
| 13 | + environment: ${{ steps.identify-target-environment.outputs.environment }} |
| 14 | + mavis_branch: ${{ steps.check-branch.outputs.mavis_branch }} |
| 15 | + steps: |
| 16 | + - name: Check if branch exists |
| 17 | + id: check-branch |
| 18 | + run: | |
| 19 | + if git ls-remote --exit-code --heads https://github.com/nhsuk/manage-vaccinations-in-schools.git ${{ github.head_ref }} > /dev/null 2>&1; then |
| 20 | + echo "mavis_branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT |
| 21 | + else |
| 22 | + echo "mavis_branch=main" >> $GITHUB_OUTPUT |
| 23 | + fi |
| 24 | + - name: Identify target environment |
| 25 | + id: identify-target-environment |
| 26 | + run: | |
| 27 | + environment='qa' |
| 28 | + if [[ -n "${{ steps.check-branch.outputs.mavis_branch }}" ]]; then |
| 29 | + environment='container' |
| 30 | + fi |
| 31 | + echo "environment=environment" >> $GITHUB_OUTPUT |
| 32 | + run-tests-against-staging: |
| 33 | + needs: identify-target-environment |
| 34 | + if: needs.identify-target-environment.outputs.environment != 'container' |
| 35 | + uses: ./.github/workflows/functional_selected_device.yaml |
| 36 | + permissions: |
| 37 | + contents: write |
| 38 | + with: |
| 39 | + tests: '' |
| 40 | + cross_service_tests: false |
| 41 | + github_ref: ${{ github.ref }} |
| 42 | + endpoint: 'https://qa.mavistesting.com' |
| 43 | + device: 'Desktop Chrome' |
| 44 | + programmes: 'FLU,HPV,MENACWY,MMR,TD_IPV' |
| 45 | + screenshot_all_steps: false |
| 46 | + enable_reruns: false |
| 47 | + test_workers: '4' |
| 48 | + set_feature_flags: false |
| 49 | + additional_feature_flags: '' |
| 50 | + secrets: |
| 51 | + HTTP_AUTH_TOKEN_FOR_TESTS: ${{ secrets.HTTP_AUTH_TOKEN_FOR_TESTS }} |
| 52 | + run-tests-against-container: |
| 53 | + needs: identify-target-environment |
| 54 | + if: needs.identify-target-environment.outputs.environment == 'container' |
| 55 | + uses: nhsuk/manage-vaccinations-in-schools/.github/workflows/end-to-end-tests.yml@containerized_regression_tests_for_PRs #TODO: Change once this is in main |
| 56 | + permissions: |
| 57 | + id-token: write |
| 58 | + contents: write |
| 59 | + with: |
| 60 | + github_ref: ${{ needs.identify-target-environment.outputs.mavis_branch }} |
| 61 | + secrets: |
| 62 | + HTTP_AUTH_TOKEN_FOR_TESTS: ${{ secrets.HTTP_AUTH_TOKEN_FOR_TESTS }} |
| 63 | + MAVIS_TESTING_REPO_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments