Skip to content

Commit 3dfd5ce

Browse files
committed
chore: add multi region selection
1 parent 329952c commit 3dfd5ce

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

.github/workflows/run-e2e-tests.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
id-token: write # needed to interact with GitHub's OIDC Token endpoint.
2222
contents: read
2323
strategy:
24-
max-parallel: 30
2524
matrix:
2625
package:
2726
[
@@ -42,11 +41,14 @@ jobs:
4241
- name: Extract PR details
4342
id: extract_PR_details
4443
if: ${{ inputs.prNumber != '' }}
45-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
46-
with:
47-
script: |
48-
const script = require('.github/scripts/get_pr_info.js');
49-
await script({github, context, core});
44+
run: |
45+
# Get the PR number from the input
46+
pr_number=${{ inputs.prNumber }}
47+
# Get the headSHA of the PR
48+
head_sha=$(gh pr view $pr_number --json headRefOid -q '.headRefOid')
49+
# Set the headSHA as an output variable
50+
echo "headSHA=$head_sha" >> $GITHUB_OUTPUT
51+
echo "headSHA=$head_sha"
5052
# Only if a PR Number was passed and the headSHA of the PR extracted,
5153
# we checkout the PR at that point in time
5254
- name: Checkout PR code
@@ -62,11 +64,20 @@ jobs:
6264
uses: aws-powertools/actions/.github/actions/cached-node-modules@29979bc5339bf54f76a11ac36ff67701986bb0f0
6365
with:
6466
nodeVersion: '22'
67+
- name: Select region
68+
id: select_region
69+
run: |
70+
regions_available=(eu-west-1 us-east-1)
71+
region=${regions_available[$((RANDOM % ${#regions[@]}))]}
72+
region=${regions_available[$((RANDOM % ${#regions_available[@]}))]}
73+
# Set the region as an output variable
74+
echo "region=$region" >> $GITHUB_OUTPUT
75+
echo "deployment_region=$region"
6576
- name: Setup AWS credentials
6677
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
6778
with:
6879
role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_ASSUME }}
69-
aws-region: eu-west-1
80+
aws-region: ${{ steps.select_region.outputs.region }}
7081
mask-aws-account-id: true
7182
- name: Run integration tests on utils
7283
env:

0 commit comments

Comments
 (0)