From 9a65a0479c9d2d88f2374e8ab7bf2946bc5dd553 Mon Sep 17 00:00:00 2001 From: Brandon Ly Date: Fri, 1 Dec 2023 10:13:44 -0600 Subject: [PATCH] [DOP-4003]: Use custom webhook for initial feature branch deploy (#941) * [DOP-4003]: Add test workflow * [DOP-4003]: Use correct path * [DOP-4003]: Use branch action path * [DOP-4003]: Comment out extra steps temporarily * [DOP-4003]: Move test action * [DOP-4003]: Add github token * [DOP-4003]: Add custom webhook to update feature branch for testing * [DOP-4003]: Add meaningless commit to trigger webhook deploy * [DOP-4003]: Update path filter * [DOP-4003]: Add meaningless commit to trigger webhook deploy * [DOP-4003]: Add meaningless commit to trigger webhook deploy * [DOP-4003]: Add meaningless commit to trigger webhook deploy * [DOP-4003]: Add meaningless commit to trigger webhook deploy * [DOP-4003]: Add meaningless commit to trigger webhook deploy * [DOP-4003]: Add meaningless commit to trigger webhook deploy * [DOP-4003]: Move webhook comment action to correct workflow * [DOP-4003]: Clean up --- .github/scripts/webhook-pr-comment.js | 14 -------------- .github/workflows/deploy-feature-branch.yml | 13 +------------ .github/workflows/update-feature-branch.yml | 1 - 3 files changed, 1 insertion(+), 27 deletions(-) delete mode 100644 .github/scripts/webhook-pr-comment.js diff --git a/.github/scripts/webhook-pr-comment.js b/.github/scripts/webhook-pr-comment.js deleted file mode 100644 index 19c60882d..000000000 --- a/.github/scripts/webhook-pr-comment.js +++ /dev/null @@ -1,14 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -module.exports = () => { - try { - const outputsFile = fs.readFileSync('cdk-infra/outputs.json').toString(); - const outputs = JSON.parse(outputsFile); - - const webhook = Object.values(outputs[`auto-builder-stack-enhancedApp-stg-${process.env.GIT_BRANCH}-webhooks`])[0]; - return webhook; - } catch (error) { - console.log('Error occurred when retrieving Webhook URL', error); - return ''; - } -}; diff --git a/.github/workflows/deploy-feature-branch.yml b/.github/workflows/deploy-feature-branch.yml index 9e7d6d150..764c90c83 100644 --- a/.github/workflows/deploy-feature-branch.yml +++ b/.github/workflows/deploy-feature-branch.yml @@ -30,17 +30,6 @@ jobs: npm run deploy:feature:stack -- -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-worker npm run deploy:feature:stack -- -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-webhooks --outputs-file outputs.json - name: Get Webhook URL - uses: actions/github-script@v6 - id: webhook - env: - GIT_BRANCH: ${{github.head_ref}} - with: - script: | - const script = require('./.github/scripts/webhook-pr-comment.js'); - return script() - result-encoding: string - - name: Comment on PR - if: steps.webhook.outputs.result != '' - run: gh pr comment ${{github.event.number}} --body "The URL for your feature branch webhook is ${{steps.webhook.outputs.result}}" + uses: mongodb/docs-worker-actions/comment-pr@main env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/update-feature-branch.yml b/.github/workflows/update-feature-branch.yml index cf2028fae..ba672bc28 100644 --- a/.github/workflows/update-feature-branch.yml +++ b/.github/workflows/update-feature-branch.yml @@ -47,7 +47,6 @@ jobs: npm ci npm run deploy:feature:stack -- -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} \ auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-webhooks - - name: Update Worker Stack if: steps.filter.outputs.worker == 'true' run: |