From e0d4b4f64835f8dc5688ea6a4422a46ce91e6158 Mon Sep 17 00:00:00 2001 From: rory Date: Fri, 23 Jun 2023 14:52:51 -0700 Subject: [PATCH 1/5] Use gh cli to get user teams membership --- .github/workflows/preDeploy.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/preDeploy.yml b/.github/workflows/preDeploy.yml index ef97788d3bef..c6d78154ff4b 100644 --- a/.github/workflows/preDeploy.yml +++ b/.github/workflows/preDeploy.yml @@ -170,7 +170,7 @@ jobs: runs-on: ubuntu-latest outputs: - IS_EXPENSIFY_EMPLOYEE: ${{ fromJSON(steps.checkActor.outputs.isTeamMember) }} + IS_EXPENSIFY_EMPLOYEE: ${{ fromJSON(steps.checkAuthor.outputs.IS_EXPENSIFY_EMPLOYEE) }} steps: - name: Get merged pull request @@ -179,13 +179,16 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} - - name: Check whether the actor is member of Expensify/expensify team - id: checkActor - uses: tspascoal/get-user-teams-membership@baf2e6adf4c3b897bd65a7e3184305c165aec872 - with: + - name: Check whether the PR author is member of Expensify/expensify team + id: checkAuthor + run: | + if gh api /orgs/Expensify/teams/infra/memberships/${{ steps.getMergedPullRequest.outputs.author }} --silent; then + echo "IS_EXPENSIFY_EMPLOYEE=true" >> "$GITHUB_OUTPUT" + else + echo "IS_EXPENSIFY_EMPLOYEE=false" >> "$GITHUB_OUTPUT" + fi + env: GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} - username: ${{ steps.getMergedPullRequest.outputs.author }} - team: Expensify/expensify newContributorWelcomeMessage: runs-on: ubuntu-latest From 5a1986d654c7da52981f9f6c1f984c4c354a81bb Mon Sep 17 00:00:00 2001 From: rory Date: Fri, 23 Jun 2023 14:56:53 -0700 Subject: [PATCH 2/5] Update platformDeploy.yml --- .github/workflows/platformDeploy.yml | 13 ++++++++----- .github/workflows/preDeploy.yml | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/platformDeploy.yml b/.github/workflows/platformDeploy.yml index f7989092fb0d..f368273c9b1f 100644 --- a/.github/workflows/platformDeploy.yml +++ b/.github/workflows/platformDeploy.yml @@ -16,14 +16,17 @@ jobs: validateActor: runs-on: ubuntu-latest outputs: - IS_DEPLOYER: ${{ fromJSON(steps.isUserDeployer.outputs.isTeamMember) || github.actor == 'OSBotify' }} + IS_DEPLOYER: ${{ fromJSON(steps.isUserDeployer.outputs.IS_DEPLOYER) || github.actor == 'OSBotify' }} steps: - id: isUserDeployer - uses: tspascoal/get-user-teams-membership@baf2e6adf4c3b897bd65a7e3184305c165aec872 - with: + run: | + if gh api /orgs/Expensify/teams/mobile-deployers/memberships/${{ steps.getMergedPullRequest.outputs.author }} --silent; then + echo "IS_DEPLOYER=true" >> "$GITHUB_OUTPUT" + else + echo "IS_DEPLOYER=false" >> "$GITHUB_OUTPUT" + fi + env: GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} - username: ${{ github.actor }} - team: mobile-deployers android: name: Build and deploy Android diff --git a/.github/workflows/preDeploy.yml b/.github/workflows/preDeploy.yml index c6d78154ff4b..27ab64397f72 100644 --- a/.github/workflows/preDeploy.yml +++ b/.github/workflows/preDeploy.yml @@ -182,7 +182,7 @@ jobs: - name: Check whether the PR author is member of Expensify/expensify team id: checkAuthor run: | - if gh api /orgs/Expensify/teams/infra/memberships/${{ steps.getMergedPullRequest.outputs.author }} --silent; then + if gh api /orgs/Expensify/teams/expensify-expensify/memberships/${{ steps.getMergedPullRequest.outputs.author }} --silent; then echo "IS_EXPENSIFY_EMPLOYEE=true" >> "$GITHUB_OUTPUT" else echo "IS_EXPENSIFY_EMPLOYEE=false" >> "$GITHUB_OUTPUT" From 4741876f71b92d7e2cac6c81195241644df9b7ce Mon Sep 17 00:00:00 2001 From: rory Date: Fri, 23 Jun 2023 14:58:59 -0700 Subject: [PATCH 3/5] Update testBuild.yml --- .github/workflows/platformDeploy.yml | 2 +- .github/workflows/testBuild.yml | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/platformDeploy.yml b/.github/workflows/platformDeploy.yml index f368273c9b1f..cc6653aa9aa0 100644 --- a/.github/workflows/platformDeploy.yml +++ b/.github/workflows/platformDeploy.yml @@ -20,7 +20,7 @@ jobs: steps: - id: isUserDeployer run: | - if gh api /orgs/Expensify/teams/mobile-deployers/memberships/${{ steps.getMergedPullRequest.outputs.author }} --silent; then + if gh api /orgs/Expensify/teams/mobile-deployers/memberships/${{ github.actor }} --silent; then echo "IS_DEPLOYER=true" >> "$GITHUB_OUTPUT" else echo "IS_DEPLOYER=false" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index 2b2db82c36b0..246e31178564 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -17,14 +17,17 @@ jobs: validateActor: runs-on: ubuntu-latest outputs: - READY_TO_BUILD: ${{ fromJSON(steps.isUserTeamMember.outputs.isTeamMember) && fromJSON(steps.hasReadyToBuildLabel.outputs.HAS_READY_TO_BUILD_LABEL) }} + READY_TO_BUILD: ${{ fromJSON(steps.isExpensifyEmployee.outputs.IS_EXPENSIFY_EMPLOYEE) && fromJSON(steps.hasReadyToBuildLabel.outputs.HAS_READY_TO_BUILD_LABEL) }} steps: - - id: isUserTeamMember - uses: tspascoal/get-user-teams-membership@baf2e6adf4c3b897bd65a7e3184305c165aec872 - with: + - id: isExpensifyEmployee + run: | + if gh api /orgs/Expensify/teams/expensify-expensify/memberships/${{ github.actor }} --silent; then + echo "IS_EXPENSIFY_EMPLOYEE=true" >> "$GITHUB_OUTPUT" + else + echo "IS_EXPENSIFY_EMPLOYEE=false" >> "$GITHUB_OUTPUT" + fi + env: GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} - username: ${{ github.actor }} - team: 'Expensify/expensify' - id: hasReadyToBuildLabel name: Set HAS_READY_TO_BUILD_LABEL flag From d2883ae6d648e15c6a210250550097ba69432f3f Mon Sep 17 00:00:00 2001 From: rory Date: Fri, 23 Jun 2023 15:01:58 -0700 Subject: [PATCH 4/5] Update finishReleaseCycle --- .github/workflows/finishReleaseCycle.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/finishReleaseCycle.yml b/.github/workflows/finishReleaseCycle.yml index 828f27a483e5..b78a5fac4b69 100644 --- a/.github/workflows/finishReleaseCycle.yml +++ b/.github/workflows/finishReleaseCycle.yml @@ -10,18 +10,21 @@ jobs: runs-on: ubuntu-latest if: contains(github.event.issue.labels.*.name, 'StagingDeployCash') outputs: - isValid: ${{ fromJSON(steps.validateActor.outputs.isTeamMember) && !fromJSON(steps.checkDeployBlockers.outputs.HAS_DEPLOY_BLOCKERS) }} + isValid: ${{ fromJSON(steps.isDeployer.outputs.IS_DEPLOYER) && !fromJSON(steps.checkDeployBlockers.outputs.HAS_DEPLOY_BLOCKERS) }} steps: - name: Validate actor is deployer - id: validateActor - uses: tspascoal/get-user-teams-membership@baf2e6adf4c3b897bd65a7e3184305c165aec872 - with: + id: isDeployer + run: | + if gh api /orgs/Expensify/teams/mobile-deployers/memberships/${{ github.actor }} --silent; then + echo "IS_DEPLOYER=true" >> "$GITHUB_OUTPUT" + else + echo "IS_DEPLOYER=false" >> "$GITHUB_OUTPUT" + fi + env: GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} - username: ${{ github.actor }} - team: mobile-deployers - name: Reopen and comment on issue - if: ${{ !fromJSON(steps.validateActor.outputs.isTeamMember) }} + if: ${{ !fromJSON(steps.isDeployer.outputs.IS_DEPLOYER) }} uses: Expensify/App/.github/actions/javascript/reopenIssueWithComment@main with: GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} @@ -31,7 +34,7 @@ jobs: Reopening! - name: Check for any deploy blockers - if: ${{ fromJSON(steps.validateActor.outputs.isTeamMember) }} + if: ${{ fromJSON(steps.isDeployer.outputs.IS_DEPLOYER) }} id: checkDeployBlockers uses: Expensify/App/.github/actions/javascript/checkDeployBlockers@main with: @@ -39,7 +42,7 @@ jobs: ISSUE_NUMBER: ${{ github.event.issue.number }} - name: Reopen and comment on issue - if: ${{ fromJSON(steps.validateActor.outputs.isTeamMember) && fromJSON(steps.checkDeployBlockers.outputs.HAS_DEPLOY_BLOCKERS) }} + if: ${{ fromJSON(steps.isDeployer.outputs.IS_DEPLOYER) && fromJSON(steps.checkDeployBlockers.outputs.HAS_DEPLOY_BLOCKERS) }} uses: Expensify/App/.github/actions/javascript/reopenIssueWithComment@main with: GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} From b464fbf71fc2d3a0e3f37596ddabe4c4d47f51df Mon Sep 17 00:00:00 2001 From: rory Date: Fri, 23 Jun 2023 15:03:53 -0700 Subject: [PATCH 5/5] Update cherryPick.yml --- .github/workflows/cherryPick.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 4bbe850b11ab..d4e6a59fa757 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -15,14 +15,17 @@ jobs: validateActor: runs-on: ubuntu-latest outputs: - IS_DEPLOYER: ${{ fromJSON(steps.isUserDeployer.outputs.isTeamMember) || github.actor == 'OSBotify' }} + IS_DEPLOYER: ${{ fromJSON(steps.isDeployer.outputs.IS_DEPLOYER) || github.actor == 'OSBotify' }} steps: - - id: isUserDeployer - uses: tspascoal/get-user-teams-membership@baf2e6adf4c3b897bd65a7e3184305c165aec872 - with: + - id: isDeployer + run: | + if gh api /orgs/Expensify/teams/mobile-deployers/memberships/${{ github.actor }} --silent; then + echo "IS_DEPLOYER=true" >> "$GITHUB_OUTPUT" + else + echo "IS_DEPLOYER=false" >> "$GITHUB_OUTPUT" + fi + env: GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} - username: ${{ github.actor }} - team: mobile-deployers createNewVersion: needs: validateActor