Skip to content

Commit 957cd23

Browse files
committed
add failure commenting to no-flags workflow and update both workflowsto use GITHUB_TOKEN
1 parent 12144d2 commit 957cd23

File tree

2 files changed

+40
-12
lines changed

2 files changed

+40
-12
lines changed

.github/workflows/test-all-custom-flags.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
name: Test-all-custom-flags
2-
run-name: All tests with extension build ${{ inputs.CLIENTS_BRANCH }} by @${{ github.actor }}
2+
run-name: All tests with extension build ${{ inputs.CLIENTS_BRANCH || github.event.client_payload.origin_branch }} by @${{ github.actor }}
33
on:
44
push:
55
branches:
66
- "main"
7+
repository_dispatch:
8+
types: [trigger-bit-tests]
79
pull_request:
810
workflow_dispatch:
911
inputs:
@@ -25,6 +27,7 @@ jobs:
2527
id-token: write
2628
contents: read
2729
packages: read
30+
pull-requests: write
2831
steps:
2932
- name: Checkout
3033
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -68,7 +71,7 @@ jobs:
6871
github_token: ${{ secrets.GITHUB_TOKEN }}
6972
workflow: build-browser.yml
7073
workflow_conclusion: ""
71-
branch: ${{ inputs.CLIENTS_BRANCH || 'main' }}
74+
branch: ${{ github.event.client_payload.origin_branch || inputs.CLIENTS_BRANCH || 'main' }}
7275
name: ^dist-chrome-MV3-\w{7}\.zip$
7376
name_is_regexp: true
7477
repo: bitwarden/clients
@@ -128,6 +131,7 @@ jobs:
128131
npm ci
129132
130133
- name: Run all tests
134+
id: playwright-tests
131135
run: npm run test:static:ci
132136

133137
- name: Update job summary
@@ -144,3 +148,29 @@ jobs:
144148
./test-summary
145149
./tests-out/videos
146150
./tests-out/screenshots
151+
152+
# Only post back to the PR if there was a failure since test-all has the
153+
# typical config case covered for success feedback
154+
- name: Communicate BIT failure on originating issue
155+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
156+
if: failure() && github.event.client_payload.origin_issue
157+
with:
158+
github-token: ${{ secrets.GITHUB_TOKEN }}
159+
script: |
160+
const owner = 'bitwarden';
161+
const message = `⚠️ **Files have been modified in this PR that impact the Autofill experience** ⚠️
162+
163+
[BIT](https://github.com/${owner}/browser-interactions-testing) was run to verify no regressions have been introduced to the core Autofill experience. The tests ran with ${{ inputs.FEATURE_FLAGS === '{}' ? 'all feature flags disabled.': '\n\n<details><summary><div>The following flags enabled:</div></summary>```json\n${{inputs.FEATURE_FLAGS}}```'}
164+
165+
❌ Unfortunately, one or more of these BIT tests failed. 😞
166+
167+
Please resolve the failure before merging; reach out to `@bitwarden/team-autofill-dev` if you'd like help.
168+
169+
You can view the detailed results of the tests [here](https://github.com/${owner}/browser-interactions-testing/actions/runs/${context.runId}).`;
170+
171+
github.rest.issues.createComment({
172+
issue_number: context.payload.client_payload.origin_issue,
173+
owner: owner,
174+
repo: 'clients',
175+
body: message
176+
});

.github/workflows/test-all.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ jobs:
141141
run: echo "$(<./test-summary/test-summary.md)" >> $GITHUB_STEP_SUMMARY
142142

143143
- name: Upload results as artifact
144-
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
144+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
145145
if: always()
146146
with:
147147
name: test-summary
@@ -151,18 +151,18 @@ jobs:
151151
./tests-out/videos
152152
./tests-out/screenshots
153153
154-
- name: Communicate BIT success on originating issue
154+
- name: Communicate BIT failure on originating issue
155155
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
156156
if: failure() && github.event.client_payload.origin_issue
157157
with:
158-
github-token: ${{ secrets.CROSS_REPO_TOKEN }}
158+
github-token: ${{ secrets.GITHUB_TOKEN }}
159159
script: |
160160
const owner = 'bitwarden';
161161
const message = `⚠️ **Files have been modified in this PR that impact the Autofill experience** ⚠️
162162
163163
[BIT](https://github.com/${owner}/browser-interactions-testing) was run to verify no regressions have been introduced to the core Autofill experience. The tests ran with the same feature flag configuration used by the `${{ REMOTE_VAULT_CONFIG_MATCH || 'US production'}}` server.
164164
165-
❌ Unfortunately, one or more of the BIT tests failed. 😞
165+
❌ Unfortunately, one or more of these BIT tests failed. 😞
166166
167167
Please resolve the failure before merging; reach out to `@bitwarden/team-autofill-dev` if you'd like help.
168168
@@ -175,20 +175,18 @@ jobs:
175175
body: message
176176
});
177177
178-
- name: Communicate BIT failure on originating issue
178+
- name: Communicate BIT success on originating issue
179179
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
180180
if: success() && github.event.client_payload.origin_issue
181181
with:
182-
github-token: ${{ secrets.CROSS_REPO_TOKEN }}
182+
github-token: ${{ secrets.GITHUB_TOKEN }}
183183
script: |
184184
const owner = 'bitwarden';
185185
const message = `⚠️ **Files have been modified in this PR that impact the Autofill experience** ⚠️
186186
187-
[BIT](https://github.com/${owner}/browser-interactions-testing) was run to verify no regressions have been introduced to the core Autofill experience. The tests ran with the same feature flag configuration used by the `${{ REMOTE_VAULT_CONFIG_MATCH || 'US production'}}` server.
188-
189-
✅ Fortunately, these BIT tests have passed! 🎉
187+
[BIT](https://github.com/${owner}/browser-interactions-testing) was run to verify no regressions have been introduced to the core Autofill experience.
190188
191-
You can view the detailed results of the tests [here](https://github.com/${owner}/browser-interactions-testing/actions/runs/${context.runId}).`;
189+
✅ Fortunately, [these BIT tests have passed](https://github.com/${owner}/browser-interactions-testing/actions/runs/${context.runId})! 🎉
192190
193191
github.rest.issues.createComment({
194192
issue_number: context.payload.client_payload.origin_issue,

0 commit comments

Comments
 (0)