Merge pull request #30627 from dukenv0307/fix/30496 #10555
This file contains 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: Process new code merged to main | |
on: | |
push: | |
branches: [main] | |
paths-ignore: [docs/**, contributingGuides/**, jest/**, tests/**, workflow_tests/**] | |
jobs: | |
typecheck: | |
uses: Expensify/App/.github/workflows/typecheck.yml@main | |
lint: | |
uses: Expensify/App/.github/workflows/lint.yml@main | |
test: | |
uses: Expensify/App/.github/workflows/test.yml@main | |
confirmPassingBuild: | |
runs-on: ubuntu-latest | |
needs: [typecheck, lint, test] | |
if: ${{ always() }} | |
steps: | |
- name: Announce failed workflow in Slack | |
if: ${{ needs.typecheck.result == 'failure' || needs.lint.result == 'failure' || needs.test.result == 'failure' }} | |
uses: Expensify/App/.github/actions/composite/announceFailedWorkflowInSlack@main | |
with: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
- name: Exit failed workflow | |
if: ${{ needs.typecheck.result == 'failure' || needs.lint.result == 'failure' || needs.test.result == 'failure' }} | |
run: exit 1 | |
chooseDeployActions: | |
runs-on: ubuntu-latest | |
needs: confirmPassingBuild | |
outputs: | |
MERGED_PR: ${{ steps.getMergedPullRequest.outputs.number }} | |
SHOULD_DEPLOY: ${{ fromJSON(steps.shouldDeploy.outputs.SHOULD_DEPLOY) }} | |
steps: | |
- name: Get merged pull request | |
id: getMergedPullRequest | |
uses: actions-ecosystem/action-get-merged-pull-request@59afe90821bb0b555082ce8ff1e36b03f91553d9 | |
with: | |
github_token: ${{ github.token }} | |
- name: Check if StagingDeployCash is locked | |
id: isStagingDeployLocked | |
uses: Expensify/App/.github/actions/javascript/isStagingDeployLocked@main | |
with: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Check if merged pull request should trigger a deploy | |
id: shouldDeploy | |
run: echo "SHOULD_DEPLOY=${{ (!fromJSON(steps.isStagingDeployLocked.outputs.IS_LOCKED) && github.actor != 'OSBotify') }}" >> "$GITHUB_OUTPUT" | |
skipDeploy: | |
runs-on: ubuntu-latest | |
needs: chooseDeployActions | |
if: ${{ !fromJSON(needs.chooseDeployActions.outputs.SHOULD_DEPLOY) && github.actor != 'OSBotify' }} | |
steps: | |
- name: Comment on deferred PR | |
uses: actions-ecosystem/action-create-comment@cd098164398331c50e7dfdd0dfa1b564a1873fac | |
with: | |
github_token: ${{ secrets.OS_BOTIFY_TOKEN }} | |
number: ${{ needs.chooseDeployActions.outputs.MERGED_PR }} | |
body: | | |
:hand: This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. | |
createNewVersion: | |
needs: chooseDeployActions | |
if: ${{ fromJSON(needs.chooseDeployActions.outputs.SHOULD_DEPLOY) }} | |
uses: Expensify/App/.github/workflows/createNewVersion.yml@main | |
secrets: inherit | |
updateStaging: | |
needs: [chooseDeployActions, createNewVersion] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Run turnstyle | |
uses: softprops/turnstyle@ca99add00ff0c9cbc697d22631d2992f377e5bd5 | |
with: | |
poll-interval-seconds: 10 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Checkout main | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
token: ${{ secrets.OS_BOTIFY_TOKEN }} | |
- name: Setup Git for OSBotify | |
uses: Expensify/App/.github/actions/composite/setupGitForOSBotifyApp@8c19d6da4a3d7ce3b15c9cd89a802187d208ecab | |
with: | |
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} | |
OS_BOTIFY_APP_ID: ${{ secrets.OS_BOTIFY_APP_ID }} | |
OS_BOTIFY_PRIVATE_KEY: ${{ secrets.OS_BOTIFY_PRIVATE_KEY }} | |
- name: Update staging branch from main | |
run: | | |
# Re-create the staging branch from main | |
git switch -c staging | |
# Force-update the remote staging branch | |
git push --force origin staging | |
- name: Announce failed workflow in Slack | |
if: ${{ failure() }} | |
uses: Expensify/App/.github/actions/composite/announceFailedWorkflowInSlack@main | |
with: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
e2ePerformanceTests: | |
needs: [chooseDeployActions] | |
if: ${{ needs.chooseDeployActions.outputs.SHOULD_DEPLOY }} | |
uses: Expensify/App/.github/workflows/e2ePerformanceTests.yml@main | |
secrets: inherit | |
with: | |
PR_NUMBER: ${{ needs.chooseDeployActions.outputs.MERGED_PR }} |