Skip to content

Commit 8cd5cd4

Browse files
authored
ci: Handle in-app-messaging PR tests separately
1 parent 0c1f0bc commit 8cd5cd4

File tree

2 files changed

+64
-9
lines changed

2 files changed

+64
-9
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
uses: actions/[email protected]
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 }}

.github/workflows/test-prs.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,7 @@ concurrency:
1313

1414
on:
1515
pull_request_target:
16-
branches:
17-
[
18-
main,
19-
ui-svelte/main,
20-
ui-geo/main,
21-
ui-react@v2,
22-
studio-release,
23-
in-app-messaging/release,
24-
]
16+
branches: [main, ui-svelte/main, ui-geo/main, ui-react@v2, studio-release]
2517
types: [opened, synchronize, labeled]
2618

2719
permissions:

0 commit comments

Comments
 (0)