diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 7eac9e34cc87..5c073e6a776c 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -8,9 +8,9 @@ on: status: {} jobs: - automerge: + master: runs-on: ubuntu-latest - + if: github.event.pull_request.base.ref == 'master' && github.actor == 'OSBotify' && github.event.label.name == 'automerge' steps: - name: Export Files Changed id: changed @@ -24,7 +24,7 @@ jobs: uses: hmarr/auto-approve-action@7782c7e2bdf62b4d79bdcded8332808fd2f179cd with: github-token: ${{ secrets.GITHUB_TOKEN }} - if: github.event.pull_request.mergeable && github.event.label.name == 'automerge' && github.actor == 'OSBotify' && steps.changed.outputs.files_updated == 'android/app/build.gradle ios/ExpensifyCash/Info.plist ios/ExpensifyCashTests/Info.plist package-lock.json package.json' && steps.changed.outputs.files_created == '' && steps.changed.outputs.files_deleted == '' + if: github.event.pull_request.mergeable && steps.changed.outputs.files_updated == 'android/app/build.gradle ios/ExpensifyCash/Info.plist ios/ExpensifyCashTests/Info.plist package-lock.json package.json' && steps.changed.outputs.files_created == '' && steps.changed.outputs.files_deleted == '' - name: Check for an auto merge # Version: 0.12.0 @@ -53,3 +53,81 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + + staging: + runs-on: ubuntu-latest + if: github.event.pull_request.base.ref == 'staging' && github.actor == 'OSBotify' && github.event.label.name == 'automerge' + steps: + - name: Check for an auto approve + # Version: 2.0.0 + uses: hmarr/auto-approve-action@7782c7e2bdf62b4d79bdcded8332808fd2f179cd + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + if: github.event.pull_request.mergeable && github.event.pull_request.head.ref == 'master' + + - name: Check for an auto merge + # Version: 0.12.0 + uses: pascalgn/automerge-action@c9bd1823770819dc8fb8a5db2d11a3a95fbe9b07 + if: github.event.pull_request.mergeable && github.event.pull_request.mergeable_state == 'clean' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # This Slack step is duplicated in all workflows, if you make a change to this step, make sure to update all + # the other workflows with the same change + - uses: 8398a7/action-slack@v3 + name: Job failed Slack notification + if: ${{ failure() }} + with: + status: custom + fields: workflow, repo + custom_payload: | + { + channel: '#announce', + attachments: [{ + color: "#DB4545", + pretext: ``, + text: `💥 ${process.env.AS_REPO} failed on ${process.env.AS_WORKFLOW} workflow 💥`, + }] + } + env: + GITHUB_TOKEN: ${{ github.token }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + + production: + runs-on: ubuntu-latest + if: github.event.pull_request.base.ref == 'production' && github.actor == 'OSBotify' && github.event.label.name == 'automerge' + steps: + - name: Check for an auto approve + # Version: 2.0.0 + uses: hmarr/auto-approve-action@7782c7e2bdf62b4d79bdcded8332808fd2f179cd + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + if: github.event.pull_request.mergeable && github.event.pull_request.head.ref == 'staging' + + - name: Check for an auto merge + # Version: 0.12.0 + uses: pascalgn/automerge-action@c9bd1823770819dc8fb8a5db2d11a3a95fbe9b07 + if: github.event.pull_request.mergeable && github.event.pull_request.mergeable_state == 'clean' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # This Slack step is duplicated in all workflows, if you make a change to this step, make sure to update all + # the other workflows with the same change + - uses: 8398a7/action-slack@v3 + name: Job failed Slack notification + if: ${{ failure() }} + with: + status: custom + fields: workflow, repo + custom_payload: | + { + channel: '#announce', + attachments: [{ + color: "#DB4545", + pretext: ``, + text: `💥 ${process.env.AS_REPO} failed on ${process.env.AS_WORKFLOW} workflow 💥`, + }] + } + env: + GITHUB_TOKEN: ${{ github.token }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 1ab328213886..70f1f8dd2929 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -5,6 +5,8 @@ on: types: [created] pull_request_target: types: [opened, closed, synchronize] + pull_request: + branches-ignore: [staging, production] jobs: CLA: diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 1c0afae35981..523b17acac0f 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -3,6 +3,7 @@ name: E2E iOS Tests on: pull_request: types: [opened, synchronize] + branches-ignore: [staging, production] env: DEVELOPER_DIR: /Applications/Xcode_12.3.app/Contents/Developer diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bf0016694f7a..9fee19b8a69c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,6 +3,7 @@ name: Lint JavaScript on: pull_request: types: [opened, synchronize] + branches-ignore: [staging, production] jobs: lint: diff --git a/.github/workflows/preDeploy.yml b/.github/workflows/preDeploy.yml index 2c453cb93b25..1cd37ed380b2 100644 --- a/.github/workflows/preDeploy.yml +++ b/.github/workflows/preDeploy.yml @@ -38,9 +38,7 @@ jobs: skipDeploy: runs-on: ubuntu-latest needs: chooseDeployActions - if: | - ${{ needs.chooseDeployActions.outputs.isStagingDeployLocked == 'true' }} && - ${{ needs.chooseDeployActions.outputs.isVersionBumpPR == 'false' }} + if: ${{ needs.chooseDeployActions.outputs.isStagingDeployLocked == 'true' && needs.chooseDeployActions.outputs.isVersionBumpPR == 'false' }} steps: - name: Comment on deferred PR @@ -96,7 +94,7 @@ jobs: ./android/app/build.gradle \ ./ios/ExpensifyCash/Info.plist \ ./ios/ExpensifyCashTests/Info.plist - git commit -m "Update version to ${{ steps.bumpVersion.outputs.NEW_VERSION }}" + git commit -m "[skip actions] Update version to ${{ steps.bumpVersion.outputs.NEW_VERSION }}" - name: Create Pull Request (master) uses: peter-evans/create-pull-request@09b9ac155b0d5ad7d8d157ed32158c1b73689109 @@ -140,9 +138,7 @@ jobs: updateStaging: runs-on: ubuntu-latest needs: chooseDeployActions - if: | - ${{ needs.chooseDeployActions.outputs.isVersionBumpPR == 'true' }} && - ${{ needs.chooseDeployActions.outputs.isStagingDeployLocked == 'false' }} + if: ${{ needs.chooseDeployActions.outputs.isVersionBumpPR == 'true' && needs.chooseDeployActions.outputs.isStagingDeployLocked == 'false' }} steps: - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f @@ -153,6 +149,9 @@ jobs: - name: Checkout master branch run: git checkout master + - name: Set Staging Version + run: echo "STAGING_VERSION=$(npm run print-version --silent)" >> $GITHUB_ENV + - name: Create Pull Request # Version: 2.4.3 uses: repo-sync/pull-request@33777245b1aace1a58c87a29c90321aa7a74bd7d @@ -161,5 +160,5 @@ jobs: destination_branch: staging pr_label: automerge github_token: ${{ secrets.OS_BOTIFY_TOKEN }} - pr_title: Update version to $(npm run print-version --silent) on staging - pr_body: Update version to $(npm run print-version --silent) + pr_title: Update version to ${{ env.STAGING_VERSION }} on staging + pr_body: Update version to ${{ env.STAGING_VERSION }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2f14b32ab963..7addc4e18c98 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,6 +3,7 @@ name: Jest Unit Tests on: pull_request: types: [opened, synchronize] + branches-ignore: [staging, production] jobs: test: diff --git a/.github/workflows/verifyGithubActionBuilds.yml b/.github/workflows/verifyGithubActionBuilds.yml index 70e2cb9e7dba..21fa3213259b 100644 --- a/.github/workflows/verifyGithubActionBuilds.yml +++ b/.github/workflows/verifyGithubActionBuilds.yml @@ -3,6 +3,7 @@ name: Verify Github Action Builds on: pull_request: types: [opened, synchronize] + branches-ignore: [staging, production] jobs: verify: diff --git a/.github/workflows/verifyPodfile.yml b/.github/workflows/verifyPodfile.yml index 9727d77f3849..2cb062700dd9 100644 --- a/.github/workflows/verifyPodfile.yml +++ b/.github/workflows/verifyPodfile.yml @@ -3,6 +3,7 @@ name: Verify Podfile on: pull_request: types: [opened, synchronize] + branches-ignore: [staging, production] jobs: verify: