Skip to content

Commit 8463af9

Browse files
committed
chore: update test snapshots for a given PR
1 parent 5619801 commit 8463af9

File tree

1 file changed

+39
-12
lines changed

1 file changed

+39
-12
lines changed

.github/workflows/update-e2e-tests.yml

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ on:
44
workflow_dispatch:
55
schedule:
66
- cron: 0 5 * * 1-5 # weekdays at 5:00 AM UTC
7+
pull_request:
8+
types: [opened, labeled]
79
jobs:
810
update-tests:
911
runs-on: ubuntu-latest
12+
if: github.event_name != 'pull_request' || (github.event.action == 'labeled' && github.event.label.name == 'update-snapshots')
1013
strategy:
1114
fail-fast: false
1215
matrix:
@@ -28,7 +31,7 @@ jobs:
2831
- atlas,datafederation,db
2932
- atlas,datafederation,privatenetwork
3033
- atlas,datafederation,querylimits
31-
- atlas,decrypt
34+
# - atlas,decrypt # requires live calls to GCP/AWS/Azure
3235
# - atlas,deployments,atlasclusters # one assertion connects to DB (needs live mode)
3336
# - atlas,deployments,local,auth,deprecated # needs docker to run
3437
# - atlas,deployments,local,auth,new # needs docker to run
@@ -56,6 +59,7 @@ jobs:
5659
- brew
5760
- config
5861
- iam
62+
# - atlas,iam # need to add
5963
- kubernetes
6064
steps:
6165
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
@@ -165,31 +169,56 @@ jobs:
165169
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86
166170
with:
167171
paths: e2e-tests.xml
168-
pr:
172+
commit:
169173
runs-on: ubuntu-latest
170-
if: always()
174+
if: always() && github.event_name == 'pull_request'
171175
needs: update-tests
172176
steps:
173-
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
177+
- name: set Apix Bot token
178+
id: app-token
179+
uses: mongodb/apix-action/token@dd1d8b713effb9ac4972a3318b8e2f03b8a6d8ce
174180
with:
175-
config: ${{ vars.PERMISSIONS_CONFIG }}
181+
app-id: ${{ secrets.APIXBOT_APP_ID }}
182+
private-key: ${{ secrets.APIXBOT_APP_PEM }}
176183
- name: Checkout repository
177184
uses: actions/checkout@v4
178185
with:
179-
fetch-depth: 0
186+
token: ${{ steps.app-token.outputs.token }}
187+
ref: ${{ github.event.pull_request.head.ref }}
180188
- run: rm -rf test/e2e/.snapshots && mkdir -p test/e2e/.snapshots
181189
- name: Download artifacts
182190
uses: actions/download-artifact@v4.2.1
183191
with:
184192
pattern: snapshots_*
185193
path: test/e2e/.snapshots
186194
merge-multiple: true
187-
- name: Upload artifact
188-
uses: actions/upload-artifact@v4.6.2
195+
- name: commit
196+
run: |
197+
git config --global user.name "${{ steps.app-token.outputs.user-name }}"
198+
git config --global user.email "${{ steps.app-token.outputs.user-email }}"
199+
git add test/e2e/.snapshots
200+
git commit -m "Update snapshots"
201+
git push
202+
- uses: actions-ecosystem/action-remove-labels@v1
203+
with:
204+
github_token: ${{ steps.app-token.outputs.token }}
205+
labels: update-snapshots
206+
pr:
207+
runs-on: ubuntu-latest
208+
if: always() && github.event_name != 'pull_request'
209+
needs: update-tests
210+
steps:
211+
- name: Checkout repository
212+
uses: actions/checkout@v4
213+
with:
214+
fetch-depth: 0
215+
- run: rm -rf test/e2e/.snapshots && mkdir -p test/e2e/.snapshots
216+
- name: Download artifacts
217+
uses: actions/download-artifact@v4.2.1
189218
with:
190-
name: snapshots
219+
pattern: snapshots_*
191220
path: test/e2e/.snapshots
192-
include-hidden-files: true
221+
merge-multiple: true
193222
- name: Find JIRA ticket
194223
id: find
195224
uses: mongodb/apix-action/find-jira@dd1d8b713effb9ac4972a3318b8e2f03b8a6d8ce
@@ -250,8 +279,6 @@ jobs:
250279
base: master
251280
branch: ${{ env.JIRA_KEY }}
252281
labels: |
253-
dependencies
254-
go
255282
auto_close_jira
256283
body: |
257284
## Proposed changes

0 commit comments

Comments
 (0)