Skip to content

Commit 9525ef1

Browse files
authored
Update install Chrome script automatically for Dependabot PRs (#3095)
This updates the "update PR" workflow to automatically update the `install-chrome.sh` script when `chromedriver` has an update.
1 parent c37ba73 commit 9525ef1

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
with:
4141
dependabot: true
4242
pull-request: ${{ github.event.pull_request.number }}
43+
pull-request-title: ${{ github.event.pull_request.title }}
4344
secrets:
4445
PULL_REQUEST_UPDATE_TOKEN: ${{ secrets.PULL_REQUEST_UPDATE_TOKEN }}
4546

.github/workflows/update-pull-request.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ on:
1717
type: number
1818
required: false
1919
default: 0
20+
pull-request-title:
21+
type: string
22+
required: false
23+
default: ''
2024

2125
jobs:
2226
is-fork-pull-request:
@@ -185,6 +189,35 @@ jobs:
185189
path: packages/examples/packages
186190
key: cache-examples-${{ needs.prepare.outputs.COMMIT_SHA }}
187191

192+
update-chrome:
193+
name: Update Chrome
194+
runs-on: ubuntu-latest
195+
if: ${{ inputs.dependabot == true && contains(inputs.pull-request-title, 'chromedriver') }}
196+
needs:
197+
- prepare
198+
- dedupe-yarn-lock
199+
steps:
200+
- name: Restore yarn.lock
201+
uses: actions/cache/restore@v4
202+
with:
203+
path: yarn.lock
204+
key: cache-yarn-lock-${{ needs.prepare.outputs.COMMIT_SHA }}
205+
fail-on-cache-miss: true
206+
- name: Setup Node.js
207+
uses: actions/setup-node@v4
208+
with:
209+
node-version-file: '.nvmrc'
210+
cache: 'yarn'
211+
- name: Install dependencies from cache
212+
run: yarn --immutable
213+
- name: Update Chrome
214+
run: yarn update-chrome
215+
- name: Cache install script
216+
uses: actions/cache/save@v4
217+
with:
218+
path: scripts/install-chrome.sh
219+
key: cache-chrome-${{ needs.prepare.outputs.COMMIT_SHA }}
220+
188221
commit-result:
189222
name: Commit result
190223
runs-on: ubuntu-latest
@@ -193,6 +226,7 @@ jobs:
193226
- dedupe-yarn-lock
194227
- regenerate-lavamoat-policies
195228
- update-examples
229+
- update-chrome
196230
steps:
197231
- name: Checkout repository
198232
uses: actions/checkout@v4
@@ -245,5 +279,17 @@ jobs:
245279
run: |
246280
git add packages/examples/packages
247281
git commit -m "${COMMIT_PREFIX}Update example snaps" || true
282+
- name: Restore install script
283+
if: ${{ inputs.dependabot == true && contains(inputs.pull-request-title, 'chromedriver') }}
284+
uses: actions/cache/restore@v4
285+
with:
286+
path: scripts/install-chrome.sh
287+
key: cache-chrome-${{ needs.prepare.outputs.COMMIT_SHA }}
288+
fail-on-cache-miss: true
289+
- name: Commit install script
290+
if: ${{ inputs.dependabot == true && contains(inputs.pull-request-title, 'chromedriver') }}
291+
run: |
292+
git add scripts/install-chrome.sh
293+
git commit -m "${COMMIT_PREFIX}Update install Chrome script" || true
248294
- name: Push changes
249295
run: git push

0 commit comments

Comments
 (0)