From 17672cee2ae1db284a1eee81f999054853942b4e Mon Sep 17 00:00:00 2001 From: Justin Persaud Date: Tue, 24 Oct 2023 10:47:12 -0400 Subject: [PATCH 01/12] Bypass CLA check for imgbot --- .github/workflows/cla.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 54ae1048b57b3..6dd0f335ca007 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest # This job only runs for pull request comments or pull request target events (not issue comments) # It does not run for pull requests created by OSBotify - if: ${{ github.event.issue.pull_request || (github.event_name == 'pull_request_target' && github.event.pull_request.user.login != 'OSBotify') }} + if: ${{ github.event.issue.pull_request || (github.event_name == 'pull_request_target' && (github.event.pull_request.user.login != 'OSBotify' || github.event.pull_request.user.login != 'imgbot') }} steps: - name: CLA comment check uses: actions-ecosystem/action-regex-match@9c35fe9ac1840239939c59e5db8839422eed8a73 From c713b64307155fd5af6a4212ef2ddaa472d7b718 Mon Sep 17 00:00:00 2001 From: Justin Persaud Date: Tue, 24 Oct 2023 10:48:14 -0400 Subject: [PATCH 02/12] bypass reviewer checklist for imgbot --- .github/workflows/authorChecklist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/authorChecklist.yml b/.github/workflows/authorChecklist.yml index 33916d7bd10dc..7efb59498fd7d 100644 --- a/.github/workflows/authorChecklist.yml +++ b/.github/workflows/authorChecklist.yml @@ -9,7 +9,7 @@ jobs: # then you also need to go into PHP and update the name of this job in the GH_JOB_NAME_CHECKLIST constant checklist: runs-on: ubuntu-latest - if: github.actor != 'OSBotify' + if: github.actor != 'OSBotify' || github.actor != 'imgbot' steps: - name: authorChecklist.js uses: Expensify/App/.github/actions/javascript/authorChecklist@main From 29a91548f396494f12ebe949b5d517412c4a5335 Mon Sep 17 00:00:00 2001 From: Justin Persaud Date: Tue, 24 Oct 2023 11:08:12 -0400 Subject: [PATCH 03/12] fix imgbot name --- .github/workflows/authorChecklist.yml | 2 +- .github/workflows/cla.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/authorChecklist.yml b/.github/workflows/authorChecklist.yml index 7efb59498fd7d..d9673faa02701 100644 --- a/.github/workflows/authorChecklist.yml +++ b/.github/workflows/authorChecklist.yml @@ -9,7 +9,7 @@ jobs: # then you also need to go into PHP and update the name of this job in the GH_JOB_NAME_CHECKLIST constant checklist: runs-on: ubuntu-latest - if: github.actor != 'OSBotify' || github.actor != 'imgbot' + if: github.actor != 'OSBotify' || github.actor != 'imgbot[bot]' steps: - name: authorChecklist.js uses: Expensify/App/.github/actions/javascript/authorChecklist@main diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 6dd0f335ca007..3396f404b54b3 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest # This job only runs for pull request comments or pull request target events (not issue comments) # It does not run for pull requests created by OSBotify - if: ${{ github.event.issue.pull_request || (github.event_name == 'pull_request_target' && (github.event.pull_request.user.login != 'OSBotify' || github.event.pull_request.user.login != 'imgbot') }} + if: ${{ github.event.issue.pull_request || (github.event_name == 'pull_request_target' && (github.event.pull_request.user.login != 'OSBotify' || github.event.pull_request.user.login != 'imgbot[bot]') }} steps: - name: CLA comment check uses: actions-ecosystem/action-regex-match@9c35fe9ac1840239939c59e5db8839422eed8a73 From 305cf3c97bebde8e347e5a534e9908556eee11e5 Mon Sep 17 00:00:00 2001 From: Justin Persaud Date: Tue, 24 Oct 2023 11:22:08 -0400 Subject: [PATCH 04/12] setup imgbot approval --- .github/workflows/imgbot.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/imgbot.yml diff --git a/.github/workflows/imgbot.yml b/.github/workflows/imgbot.yml new file mode 100644 index 0000000000000..4ae09b7e02268 --- /dev/null +++ b/.github/workflows/imgbot.yml @@ -0,0 +1,17 @@ +name: imgbot Image Optimization + +on: pull_request + +permissions: + pull-requests: write + +jobs: + merge: + runs-on: ubuntu-latest + if: ${{ github.actor == 'imgbot[bot]' }} + steps: + - name: Approve imgbot PR + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} From 5f2762ffc0fa1722c29a5744a3050ac95cd7b851 Mon Sep 17 00:00:00 2001 From: Justin Persaud Date: Tue, 24 Oct 2023 11:55:05 -0400 Subject: [PATCH 05/12] Add step to merge --- .github/workflows/imgbot.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/imgbot.yml b/.github/workflows/imgbot.yml index 4ae09b7e02268..baed42c635e5d 100644 --- a/.github/workflows/imgbot.yml +++ b/.github/workflows/imgbot.yml @@ -6,7 +6,7 @@ permissions: pull-requests: write jobs: - merge: + approveAndMerge: runs-on: ubuntu-latest if: ${{ github.actor == 'imgbot[bot]' }} steps: @@ -15,3 +15,8 @@ jobs: env: PR_URL: ${{github.event.pull_request.html_url}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Merge imgbot PR + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} From b2645fbb52dfca8cd5dfbba167caf419faf290be Mon Sep 17 00:00:00 2001 From: Justin Persaud Date: Tue, 24 Oct 2023 12:02:40 -0400 Subject: [PATCH 06/12] Add missing bracket --- .github/workflows/cla.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 3396f404b54b3..bc48b4f1ea480 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest # This job only runs for pull request comments or pull request target events (not issue comments) # It does not run for pull requests created by OSBotify - if: ${{ github.event.issue.pull_request || (github.event_name == 'pull_request_target' && (github.event.pull_request.user.login != 'OSBotify' || github.event.pull_request.user.login != 'imgbot[bot]') }} + if: ${{ github.event.issue.pull_request || (github.event_name == 'pull_request_target' && (github.event.pull_request.user.login != 'OSBotify' || github.event.pull_request.user.login != 'imgbot[bot]')) }} steps: - name: CLA comment check uses: actions-ecosystem/action-regex-match@9c35fe9ac1840239939c59e5db8839422eed8a73 From 72ed4abaeae36f312222bef109d932fe170ecf28 Mon Sep 17 00:00:00 2001 From: Justin Persaud Date: Tue, 24 Oct 2023 12:36:26 -0400 Subject: [PATCH 07/12] Update .github/workflows/authorChecklist.yml Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com> --- .github/workflows/authorChecklist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/authorChecklist.yml b/.github/workflows/authorChecklist.yml index d9673faa02701..6cd881d18c29e 100644 --- a/.github/workflows/authorChecklist.yml +++ b/.github/workflows/authorChecklist.yml @@ -9,7 +9,7 @@ jobs: # then you also need to go into PHP and update the name of this job in the GH_JOB_NAME_CHECKLIST constant checklist: runs-on: ubuntu-latest - if: github.actor != 'OSBotify' || github.actor != 'imgbot[bot]' + if: github.actor != 'OSBotify' && github.actor != 'imgbot[bot]' steps: - name: authorChecklist.js uses: Expensify/App/.github/actions/javascript/authorChecklist@main From e5ab3925dd34f47e55e710b345abb6322dfc74a8 Mon Sep 17 00:00:00 2001 From: Justin Persaud Date: Tue, 24 Oct 2023 12:36:59 -0400 Subject: [PATCH 08/12] Update .github/workflows/cla.yml Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com> --- .github/workflows/cla.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index bc48b4f1ea480..4031d6c0c1192 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest # This job only runs for pull request comments or pull request target events (not issue comments) # It does not run for pull requests created by OSBotify - if: ${{ github.event.issue.pull_request || (github.event_name == 'pull_request_target' && (github.event.pull_request.user.login != 'OSBotify' || github.event.pull_request.user.login != 'imgbot[bot]')) }} + if: ${{ github.event.issue.pull_request || (github.event_name == 'pull_request_target' && github.event.pull_request.user.login != 'OSBotify' && github.event.pull_request.user.login != 'imgbot[bot]') }} steps: - name: CLA comment check uses: actions-ecosystem/action-regex-match@9c35fe9ac1840239939c59e5db8839422eed8a73 From dcf92764f476a22fe4b2542b6790bb9401cc68c3 Mon Sep 17 00:00:00 2001 From: Justin Persaud Date: Tue, 24 Oct 2023 12:37:53 -0400 Subject: [PATCH 09/12] Apply suggestions from code review Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com> --- .github/workflows/imgbot.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/imgbot.yml b/.github/workflows/imgbot.yml index baed42c635e5d..4de53d073011c 100644 --- a/.github/workflows/imgbot.yml +++ b/.github/workflows/imgbot.yml @@ -11,12 +11,13 @@ jobs: if: ${{ github.actor == 'imgbot[bot]' }} steps: - name: Approve imgbot PR - run: gh pr review --approve "$PR_URL" + run: gh pr review --approve "${{ env.PR_URL }}" env: PR_URL: ${{github.event.pull_request.html_url}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Merge imgbot PR - run: gh pr merge --auto --merge "$PR_URL" + run: gh pr merge --auto --merge "${{ env.PR_URL }}" env: PR_URL: ${{github.event.pull_request.html_url}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} From b95423f7d23317ea0df7d0b9cebcbdc10a0641a6 Mon Sep 17 00:00:00 2001 From: Justin Persaud Date: Tue, 24 Oct 2023 12:39:04 -0400 Subject: [PATCH 10/12] style --- .github/workflows/imgbot.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/imgbot.yml b/.github/workflows/imgbot.yml index 4de53d073011c..fd8c7f85e9585 100644 --- a/.github/workflows/imgbot.yml +++ b/.github/workflows/imgbot.yml @@ -13,11 +13,11 @@ jobs: - name: Approve imgbot PR run: gh pr review --approve "${{ env.PR_URL }}" env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Merge imgbot PR run: gh pr merge --auto --merge "${{ env.PR_URL }}" env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 2442aaf04072105a97e5757fefd7b3a0606028f3 Mon Sep 17 00:00:00 2001 From: Justin Persaud Date: Wed, 25 Oct 2023 09:55:28 -0400 Subject: [PATCH 11/12] Apply suggestions from code review Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com> --- .github/workflows/imgbot.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/imgbot.yml b/.github/workflows/imgbot.yml index fd8c7f85e9585..00a18a80a3df2 100644 --- a/.github/workflows/imgbot.yml +++ b/.github/workflows/imgbot.yml @@ -11,13 +11,11 @@ jobs: if: ${{ github.actor == 'imgbot[bot]' }} steps: - name: Approve imgbot PR - run: gh pr review --approve "${{ env.PR_URL }}" + run: gh pr review --approve "${{ github.event.pull_request.html_url }}" env: - PR_URL: ${{ github.event.pull_request.html_url }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Merge imgbot PR - run: gh pr merge --auto --merge "${{ env.PR_URL }}" + run: gh pr merge --auto --merge "${{ github.event.pull_request.html_url }}" env: - PR_URL: ${{ github.event.pull_request.html_url }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 38a3f937cc81a3e1c67a9973c9dbb01948a0b8eb Mon Sep 17 00:00:00 2001 From: Justin Persaud Date: Wed, 25 Oct 2023 10:15:02 -0400 Subject: [PATCH 12/12] Skip additional actions from imgbot --- .github/workflows/preDeploy.yml | 2 +- .github/workflows/reviewerChecklist.yml | 2 +- .github/workflows/test.yml | 6 +++--- .github/workflows/validateDocsRoutes.yml | 2 +- .github/workflows/validateGithubActions.yml | 2 +- .github/workflows/verifyPodfile.yml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/preDeploy.yml b/.github/workflows/preDeploy.yml index d7d372aa79487..11753a383219a 100644 --- a/.github/workflows/preDeploy.yml +++ b/.github/workflows/preDeploy.yml @@ -140,7 +140,7 @@ jobs: newContributorWelcomeMessage: runs-on: ubuntu-latest needs: isExpensifyEmployee - if: ${{ github.actor != 'OSBotify' && !fromJSON(needs.isExpensifyEmployee.outputs.IS_EXPENSIFY_EMPLOYEE) }} + if: ${{ github.actor != 'OSBotify' && !fromJSON(needs.isExpensifyEmployee.outputs.IS_EXPENSIFY_EMPLOYEE) && github.actor != 'imgbot[bot]' }} steps: # Version: 2.3.4 - name: Checkout diff --git a/.github/workflows/reviewerChecklist.yml b/.github/workflows/reviewerChecklist.yml index 413fc88ff4032..e86e08375269c 100644 --- a/.github/workflows/reviewerChecklist.yml +++ b/.github/workflows/reviewerChecklist.yml @@ -7,7 +7,7 @@ jobs: # then you also need to go into PHP and update the name of this job in the GH_JOB_NAME_CHECKLIST constant checklist: runs-on: ubuntu-latest - if: github.actor != 'OSBotify' + if: github.actor != 'OSBotify' && github.actor != 'imgbot[bot]' steps: - name: reviewerChecklist.js uses: Expensify/App/.github/actions/javascript/reviewerChecklist@main diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 72bdd0468fd23..c37f3a766f7cb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ on: jobs: jest: - if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_call' }} + if: ${{ github.actor != 'OSBotify' && github.actor != 'imgbot[bot]' || github.event_name == 'workflow_call' }} runs-on: ubuntu-latest env: CI: true @@ -39,7 +39,7 @@ jobs: run: npx jest --silent --shard=${{ fromJSON(matrix.chunk) }}/${{ strategy.job-total }} --max-workers ${{ steps.cpu-cores.outputs.count }} storybookTests: - if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_call' }} + if: ${{ github.actor != 'OSBotify' && github.actor != 'imgbot[bot]' || github.event_name == 'workflow_call' }} runs-on: ubuntu-latest name: Storybook tests steps: @@ -51,7 +51,7 @@ jobs: run: npm run storybook -- --smoke-test --ci shellTests: - if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_call' }} + if: ${{ github.actor != 'OSBotify' && github.actor != 'imgbot[bot]' || github.event_name == 'workflow_call' }} runs-on: ubuntu-latest name: Shell tests steps: diff --git a/.github/workflows/validateDocsRoutes.yml b/.github/workflows/validateDocsRoutes.yml index 717560e19f5f0..14c08e0875658 100644 --- a/.github/workflows/validateDocsRoutes.yml +++ b/.github/workflows/validateDocsRoutes.yml @@ -8,7 +8,7 @@ on: jobs: verify: - if: github.actor != 'OSBotify' + if: github.actor != 'OSBotify' && github.actor != 'imgbot[bot]' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/validateGithubActions.yml b/.github/workflows/validateGithubActions.yml index bcda941e1b053..2d3216fefe759 100644 --- a/.github/workflows/validateGithubActions.yml +++ b/.github/workflows/validateGithubActions.yml @@ -9,7 +9,7 @@ on: jobs: verify: - if: github.actor != 'OSBotify' + if: github.actor != 'OSBotify' && github.actor != 'imgbot[bot]' runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/verifyPodfile.yml b/.github/workflows/verifyPodfile.yml index d8d931e476d10..d98780e3e8297 100644 --- a/.github/workflows/verifyPodfile.yml +++ b/.github/workflows/verifyPodfile.yml @@ -11,7 +11,7 @@ on: jobs: verify: - if: github.actor != 'OSBotify' + if: github.actor != 'OSBotify' && github.actor != 'imgbot[bot]' runs-on: macos-latest steps: - name: Checkout