Build SDK #26
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build SDK | |
| on: | |
| pull_request_review: | |
| types: [ submitted ] | |
| branches: [ version-3 ] | |
| workflow_dispatch: | |
| concurrency: | |
| group: start-pull-request-build-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| # constants | |
| DOWNLOAD_FOLDER: '.build-scripts/' | |
| SCRIPT_LOCATION: 'workflows/start-pull-request-build/pull-request-build-v1.sh' | |
| # custom variables | |
| IAM_ROLE_ARN: 'arn:aws:iam::525369684841:role/AwsSdkRubyGitHubRole' | |
| ROLE_SESSION_DURATION_SECONDS: 7200 | |
| jobs: | |
| aws-sdk-pr-build: | |
| if: ${{ github.event_name == 'workflow_dispatch' || github.event.review.state == 'approved' }} | |
| 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@main | |
| with: | |
| role-to-assume: ${{ env.IAM_ROLE_ARN }} | |
| role-session-name: PullRequestBuildGitHubAction | |
| role-duration-seconds: '$ROLE_SESSION_DURATION_SECONDS' | |
| aws-region: us-west-2 | |
| - name: Checkout | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: actions/checkout@v4 | |
| - 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: Get PR Number | |
| id: pr | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| echo "Looking for PR with head branch: ${{ github.ref_name }}" | |
| echo "All PRs:" | |
| gh pr list --repo "${{ github.repository }}" --state all --limit 20 --json number,headRefName,baseRefName | |
| echo "Searching for match..." | |
| PR_NUMBER=$(gh pr list --repo "${{ github.repository }}" --state all --json number,headRefName --jq '.[] | select(.headRefName=="${{ github.ref_name }}") | .number' | head -1) | |
| echo "Found PR number: $PR_NUMBER" | |
| echo "number=${PR_NUMBER:-}" >> $GITHUB_OUTPUT | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| REPO: ${{ github.repository }} | |
| HEAD_REF: ${{ github.event.pull_request.head.ref || github.ref_name }} | |
| PR_NUMBER: ${{ github.event.pull_request.number || steps.pr.outputs.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: 120 |