-
-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (88 loc) · 3.34 KB
/
update-snapshot.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: update-snapshot
on:
workflow_run:
workflows: [build]
types: [completed]
jobs:
on-failure:
runs-on: ubuntu-latest
container:
image: jsii/superchain:1-buster-slim-node16
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
env:
CI: "true"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Setup Ruby
run: sudo apt-get update ; sudo apt-get install -y ruby
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
- name: Snapshot main
run: |
npm run bundle
npm run integ:default:snapshot
- name: Switch to branch
env:
BRANCH: ${{ github.event.workflow_run.head_branch }}
run: git checkout "$BRANCH"
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
- name: Snapshot branch
run: |
npm run bundle
npm run integ:default:snapshot
- name: Find mutations
id: create_patch
run: |-
git add .
git diff --staged --patch --exit-code || echo "patch_created=true" >> $GITHUB_OUTPUT
# upload snapshot (including assets from both main and branch) for easy diffing
- name: Diff
if: steps.create_patch.outputs.patch_created
working-directory: test/default.integ.snapshot
continue-on-error: true
run: |-
git diff --staged -U0 | grep '"path":' | cut -d '"' -f 4 | xargs -rL 2 diff -ruN > /tmp/assets.diff
- name: Upload assets.diff
if: steps.create_patch.outputs.patch_created
uses: actions/upload-artifact@v4
with:
name: assets.diff
path: /tmp/assets.diff
- name: Upload snapshot
if: steps.create_patch.outputs.patch_created
uses: actions/upload-artifact@v4
with:
name: snapshot
path: test/default.integ.snapshot
- name: Set git identity
if: steps.create_patch.outputs.patch_created
run: |-
git config user.name "github-actions"
git config user.email "github-actions@github.com"
# create a PR against the dependencies update PR for a proper snapshot
- name: Create Pull Request
if: steps.create_patch.outputs.patch_created
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.PROJEN_GITHUB_TOKEN }}
commit-message: |-
chore(deps): update snapshot
Update snapshot. See details in [workflow run].
[Workflow Run]: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
------
*Automatically created by projen via the "upgrade-snapshot" workflow*
branch: ${{ github.event.workflow_run.head_branch }}-upgrade-snapshot
title: "chore(deps): update snapshot"
body: |-
Update snapshot. See details in [workflow run].
[Workflow Run]: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
------
*Automatically created by projen via the "upgrade-snapshot" workflow*
author: github-actions <github-actions@github.com>
committer: github-actions <github-actions@github.com>
signoff: true