From 4a4bccc50a099a66bc55bc17ecb3c8f0c6fd44d2 Mon Sep 17 00:00:00 2001 From: aws-sdk-python-automation Date: Wed, 7 Oct 2026 14:53:54 -0400 Subject: [PATCH] Add the GitHub CI script for pull request build --- .github/workflows/pull-request-build.yml | 52 ++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/pull-request-build.yml diff --git a/.github/workflows/pull-request-build.yml b/.github/workflows/pull-request-build.yml new file mode 100644 index 00000000..357c7efe --- /dev/null +++ b/.github/workflows/pull-request-build.yml @@ -0,0 +1,52 @@ +name: Build aws-sdk-python +on: + pull_request: + types: [opened, synchronize, ready_for_review] + branches: [develop] + +concurrency: + group: start-pull-request-build-${{ github.ref }} + cancel-in-progress: true + +env: + DOWNLOAD_FOLDER: '.build-scripts/' + SCRIPT_LOCATION: 'workflows/start-pull-request-build/pull-request-build-v1.sh' + IAM_ROLE_ARN: 'arn:aws:iam::644726205228:role/AwsSdkPythonGitHubRole' + ROLE_SESSION_DURATION_SECONDS: 2700 + +jobs: + aws-sdk-pr-build: + # Skip draft PRs and PRs from forked repos (they don't have access) + if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + permissions: + id-token: write + issues: write + pull-requests: write + contents: read + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd + with: + role-to-assume: ${{ env.IAM_ROLE_ARN }} + role-session-name: PullRequestBuildGitHubAction + role-duration-seconds: ${{ env.ROLE_SESSION_DURATION_SECONDS }} + aws-region: us-west-2 + - name: Download Build Script + run: | + aws s3 cp s3://aws-sdk-builds-github-assets-prod-us-west-2/$SCRIPT_LOCATION ./$DOWNLOAD_FOLDER/$SCRIPT_LOCATION --no-progress + chmod +x ./$DOWNLOAD_FOLDER/$SCRIPT_LOCATION + - name: Build + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + HEAD_REF: ${{ github.event.pull_request.head.ref }} + PR_NUMBER: ${{ github.event.pull_request.number }} + RUN_ID: ${{ github.run_id }} + run: | + ./$DOWNLOAD_FOLDER/$SCRIPT_LOCATION \ + --repo "$REPO" \ + --branch "$HEAD_REF" \ + --pr-number "$PR_NUMBER" \ + --run-id "$RUN_ID" + timeout-minutes: 45