PM-28324: Add a guard that conditionally forces a popout depending on platform #6839
This file contains hidden or 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: DDG File Change Monitor | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| types: [ opened, synchronize ] | |
| jobs: | |
| check-files: | |
| name: Check files | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Get changed files | |
| id: changed-files | |
| uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
| with: | |
| list-files: shell | |
| filters: | | |
| monitored: | |
| - 'apps/desktop/native-messaging-test-runner/**' | |
| - 'apps/desktop/src/services/duckduckgo-message-handler.service.ts' | |
| - 'apps/desktop/src/services/encrypted-message-handler.service.ts' | |
| - name: Remove past BIT status comments | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 | |
| with: | |
| script: | | |
| // Note: should match the first line of `message` in the communication steps | |
| const workflowCommentTag = '<!-- comment_tag: ddg-test-warning -->'; | |
| const issueComments = await github.rest.issues.listComments({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| }); | |
| for (const comment of issueComments.data || []) { | |
| const shouldDeleteComment = | |
| // Do not delete comments that were not automated | |
| !!comment.performed_via_github_app && | |
| // Do not delete user comments | |
| comment.user.type === 'Bot' && | |
| // Do not delete edited comments | |
| comment.created_at === comment.updated_at && | |
| // Only delete comments from this workflow | |
| comment.body.trim().startsWith(workflowCommentTag); | |
| if (shouldDeleteComment) { | |
| await github.rest.issues.deleteComment({ | |
| comment_id: comment.id, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| }); | |
| } | |
| } | |
| - name: Comment on PR if monitored files changed | |
| if: steps.changed-files.outputs.monitored == 'true' | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 | |
| env: | |
| _MONITORED_FILES: ${{ steps.changed-files.outputs.monitored_files }} | |
| with: | |
| script: | | |
| const changedFiles = `$_MONITORED_FILES`.split(' ').filter(file => file.trim() !== ''); | |
| const message = `<!-- comment_tag: ddg-test-warning --> | |
| ⚠️🦆 **DuckDuckGo Integration files have been modified in this PR:** | |
| ${changedFiles.map(file => `- \`${file}\``).join('\n')} | |
| Please run the DuckDuckGo native messaging test runner from this branch using [these instructions](https://contributing.bitwarden.com/getting-started/clients/desktop/native-messaging-test-runner) and ensure it functions properly.`; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: message | |
| }); |