Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions .github/workflows/pull-request-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Build SDK
on:
pull_request:
types: [ opened, synchronize, ready_for_review ]
merge_group:

concurrency:
group: start-pull-request-build-${{ github.ref }}
Expand All @@ -15,15 +16,34 @@ env:

jobs:
aws-sdk-pr-build:
if: github.event.pull_request.draft == false
if: github.event.pull_request.draft == false || github.event_name == 'merge_group'
runs-on: ubuntu-latest
permissions:
id-token: write
issues: write
pull-requests: write
contents: read
steps:
- name: Check if merge queue build is needed
if: github.event_name == 'merge_group'
id: queue-check
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BASE_SHA="${{ github.event.merge_group.base_sha }}"
BASE_REF="${{ github.event.merge_group.base_ref }}"
# base_ref is in refs/heads/<branch> format, strip prefix for API call
BRANCH_NAME="${BASE_REF#refs/heads/}"
TARGET_SHA=$(gh api repos/${{ github.repository }}/git/ref/heads/${BRANCH_NAME} --jq '.object.sha')
if [ "$BASE_SHA" == "$TARGET_SHA" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "First in queue — PR build already validated this combination, skipping."
else
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "Not first in queue — merge group includes changes from other PRs, build needed."
fi
- name: Configure AWS Credentials
if: steps.queue-check.outputs.skip != 'true'
uses: aws-actions/configure-aws-credentials@main
with:
role-to-assume: ${{ env.IAM_ROLE_ARN }}
Expand All @@ -32,15 +52,17 @@ jobs:
aws-region: us-west-2
role-duration-seconds: 7200
- name: Download Build Script
if: steps.queue-check.outputs.skip != 'true'
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
if: steps.queue-check.outputs.skip != 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
HEAD_REF: ${{ github.event.pull_request.head.ref }}
PR_NUMBER: ${{ github.event.pull_request.number }}
HEAD_REF: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
PR_NUMBER: ${{ github.event.pull_request.number || '0' }}
RUN_ID: ${{ github.run_id }}
run: |
./$DOWNLOAD_FOLDER/$SCRIPT_LOCATION \
Expand Down
Loading