Skip to content

Commit

Permalink
Merge pull request Expensify#13937 from Expensify/andrew-fix-testBuild
Browse files Browse the repository at this point in the history
  • Loading branch information
roryabraham authored Jan 2, 2023
2 parents 12fad41 + 4ff7b24 commit 424786c
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,33 @@ jobs:
validateActor:
runs-on: ubuntu-latest
outputs:
READY_TO_BUILD: ${{steps.readyToBuild.outputs.READY_TO_BUILD}}
READY_TO_BUILD: ${{ fromJSON(steps.isUserTeamMember.outputs.isTeamMember) && fromJSON(steps.hasReadyToBuildLabel.outputs.HAS_READY_TO_BUILD_LABEL) }}
steps:
- id: isUserTeamMember
uses: tspascoal/get-user-teams-membership@baf2e6adf4c3b897bd65a7e3184305c165aec872
with:
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
username: ${{ github.actor }}
team: expensify-expensify
- name: Remove label if it was added by an unauthorized user
if: ${{ !fromJSON(steps.isUserTeamMember.outputs.isTeamMember) && github.event.label.name == 'Ready To Build' }}
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: 'Ready To Build'
- name: Throw exception if label was added by an unauthorized user
if: ${{ !fromJSON(steps.isUserTeamMember.outputs.isTeamMember) && github.event.label.name == 'Ready To Build' }}
run: |
echo "The 'Ready To Build' label was added by an unauthorized user"
exit 1
- id: readyToBuild
name: Set READY_TO_BUILD flag
run: echo "READY_TO_BUILD=${{ fromJSON(steps.isUserTeamMember.outputs.isTeamMember) || contains(github.event.pull_request.labels.*.name, 'Ready To Build') }}" >> "$GITHUB_OUTPUT"

- id: hasReadyToBuildLabel
name: Set HAS_READY_TO_BUILD_LABEL flag
run: echo "HAS_READY_TO_BUILD_LABEL=$(gh pr view "${{ env.PULL_REQUEST_NUMBER }}" --json labels --jq '.labels[].name' | grep -q 'Ready To Build' && echo 'true')" >> "$GITHUB_OUTPUT"
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
GITHUB_TOKEN: ${{ github.token }}

getBranchRef:
runs-on: ubuntu-latest
needs: validateActor
if: ${{ needs.validateActor.outputs.READY_TO_BUILD == 'true' }}
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
outputs:
REF: ${{steps.getHeadRef.outputs.REF}}
steps:
- name: Checkout
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- name: Check if pull request number is correct
if: ${{ github.event_name == 'workflow_dispatch' }}
id: getHeadRef
Expand All @@ -62,7 +57,7 @@ jobs:
android:
name: Build and deploy Android for testing
needs: [validateActor, getBranchRef]
if: ${{ needs.validateActor.outputs.READY_TO_BUILD == 'true' }}
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
runs-on: ubuntu-latest
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
Expand Down Expand Up @@ -112,7 +107,7 @@ jobs:
iOS:
name: Build and deploy iOS for testing
needs: [validateActor, getBranchRef]
if: ${{ needs.validateActor.outputs.READY_TO_BUILD == 'true' }}
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
runs-on: macos-12
Expand Down Expand Up @@ -168,7 +163,7 @@ jobs:
desktop:
name: Build and deploy Desktop for testing
needs: [validateActor, getBranchRef]
if: ${{ needs.validateActor.outputs.READY_TO_BUILD == 'true' }}
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
runs-on: macos-12
Expand Down Expand Up @@ -205,7 +200,7 @@ jobs:
web:
name: Build and deploy Web
needs: [validateActor, getBranchRef]
if: ${{ needs.validateActor.outputs.READY_TO_BUILD == 'true' }}
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
runs-on: ubuntu-latest
Expand All @@ -214,7 +209,9 @@ jobs:
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || needs.getBranchRef.outputs.REF }}

- uses: Expensify/App/.github/actions/composite/setupNode@main

- name: Configure AWS Credentials
uses: Expensify/App/.github/actions/composite/configureAwsCredentials@main
with:
Expand Down

0 comments on commit 424786c

Please sign in to comment.