Skip to content

Commit c39d208

Browse files
authored
Add the GitHub CI script for pull request build (aws#10182)
1 parent 281e634 commit c39d208

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build internal AWS CLI v1
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, ready_for_review]
5+
branches: [develop]
6+
7+
concurrency:
8+
group: start-pull-request-build-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
env:
12+
DOWNLOAD_FOLDER: '.build-scripts/'
13+
SCRIPT_LOCATION: 'workflows/start-pull-request-build/pull-request-build-v1.sh'
14+
IAM_ROLE_ARN: 'arn:aws:iam::066695136813:role/AwsCliGitHubRole'
15+
ROLE_SESSION_DURATION_SECONDS: 7200
16+
17+
jobs:
18+
aws-sdk-pr-build:
19+
# Skip draft PRs and PRs from forked repos (they don't have access)
20+
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.repository
21+
runs-on: ubuntu-latest
22+
permissions:
23+
id-token: write
24+
issues: write
25+
pull-requests: write
26+
contents: read
27+
steps:
28+
- name: Configure AWS Credentials
29+
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7
30+
with:
31+
role-to-assume: ${{ env.IAM_ROLE_ARN }}
32+
role-session-name: PullRequestBuildGitHubAction
33+
role-duration-seconds: ${{ env.ROLE_SESSION_DURATION_SECONDS }}
34+
aws-region: us-west-2
35+
- name: Download Build Script
36+
run: |
37+
aws s3 cp s3://aws-sdk-builds-github-assets-prod-us-west-2/$SCRIPT_LOCATION ./$DOWNLOAD_FOLDER/$SCRIPT_LOCATION --no-progress
38+
chmod +x ./$DOWNLOAD_FOLDER/$SCRIPT_LOCATION
39+
- name: Build
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
REPO: ${{ github.repository }}
43+
HEAD_REF: ${{ github.event.pull_request.head.ref }}
44+
PR_NUMBER: ${{ github.event.pull_request.number }}
45+
RUN_ID: ${{ github.run_id }}
46+
run: |
47+
./$DOWNLOAD_FOLDER/$SCRIPT_LOCATION \
48+
--repo "$REPO" \
49+
--branch "$HEAD_REF" \
50+
--pr-number "$PR_NUMBER" \
51+
--run-id "$RUN_ID"
52+
timeout-minutes: 120

0 commit comments

Comments
 (0)