Skip to content

Commit 025edae

Browse files
committed
ci: Add GitHub Actions workflow for pull request builds
Add automated build workflow that triggers on approved pull request reviews to validate changes before merge.
1 parent 3d6e7ab commit 025edae

File tree

1 file changed

+54
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)