|
| 1 | +# Description: This workflow runs unit + e2e tests on PRs targeting |
| 2 | +# - `in-app-messaging/main` |
| 3 | +# - `in-app-messaging/release` |
| 4 | +# |
| 5 | +# Triggered by: |
| 6 | +# (1) Internal PRs: maintainer pushes a commit to PRs targeting those branches. |
| 7 | +# (2) Fork PRs: maintainer adds "run-test" label to PRs targeting those branches. |
| 8 | + |
| 9 | +name: Test / in-app-messaging / PRs |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: e2e-${{ github.event.pull_request.id }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +on: |
| 16 | + pull_request_target: |
| 17 | + branches: [ |
| 18 | + in-app-messaging/main |
| 19 | + in-app-messaging/release, |
| 20 | + ] |
| 21 | + types: [opened, synchronize, labeled] |
| 22 | + |
| 23 | +permissions: |
| 24 | + pull-requests: write # used to remove label |
| 25 | + # other permissions are defaulted to "none" |
| 26 | + |
| 27 | +jobs: |
| 28 | + setup: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + # We run tests only if it's: |
| 31 | + # 1) pull request not from a fork (ie. internal PR), or |
| 32 | + # 2) pull request from a fork (ie. external PR) that was added "run-tests" label |
| 33 | + if: | |
| 34 | + (github.event.pull_request.head.repo.full_name == github.repository) || |
| 35 | + (github.event.action == 'labeled' && github.event.label.name == 'run-tests') |
| 36 | + steps: |
| 37 | + - name: Remove run-tests label, if applicable |
| 38 | + if: always() && github.event.label.name == 'run-tests' |
| 39 | + |
| 40 | + with: |
| 41 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 42 | + script: | |
| 43 | + const { issue: { number: issue_number }, repo: { owner, repo } } = context; |
| 44 | + const label = 'run-tests'; |
| 45 | + github.issues.removeLabel({ owner, repo, issue_number, name: label }); |
| 46 | + test: |
| 47 | + uses: aws-amplify/amplify-ui/.github/workflows/reusable-e2e.yml@in-app-messaging/main |
| 48 | + needs: setup |
| 49 | + with: |
| 50 | + commit: ${{ github.event.pull_request.head.sha }} |
| 51 | + repository: ${{ github.event.pull_request.head.repo.full_name }} |
| 52 | + secrets: |
| 53 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 54 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 55 | + DOMAIN: ${{ secrets.DOMAIN }} |
| 56 | + PHONE_NUMBER: ${{ secrets.PHONE_NUMBER }} |
| 57 | + USERNAME: ${{ secrets.USERNAME }} |
| 58 | + NEW_PASSWORD: ${{ secrets.NEW_PASSWORD }} |
| 59 | + VALID_PASSWORD: ${{ secrets.VALID_PASSWORD }} |
| 60 | + SITE_URL: ${{ secrets.SITE_URL }} |
| 61 | + DOCSEARCH_DOCS_APP_ID: ${{ secrets.DOCSEARCH_DOCS_APP_ID }} |
| 62 | + DOCSEARCH_DOCS_API_KEY: ${{ secrets.DOCSEARCH_DOCS_API_KEY }} |
| 63 | + DOCSEARCH_DOCS_INDEX_NAME: ${{ secrets.DOCSEARCH_DOCS_INDEX_NAME }} |
0 commit comments