Skip to content

Commit 862562e

Browse files
authored
ci: run browser tests on pull_request_target (#703)
pull_request_target allows runs to access the secret values. Since this adds an attack vector described here https://securitylab.github.com/research/github-actions-preventing-pwn-requests/, the extra condition to only run on the main repo push or if someone adds a safe to test label after reviewing the code is added.
1 parent e6b0c90 commit 862562e

2 files changed

Lines changed: 11 additions & 12 deletions

File tree

.github/workflows/browser.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
name: Browser
22

3-
on: [push]
3+
on:
4+
push:
5+
pull_request_target:
6+
types: [labeled]
47

58
jobs:
69
browser:
7-
10+
if: github.repository == 'uuidjs/uuid' && (contains(github.event.pull_request.labels.*.name, 'safe to test') || github.event_name == 'push')
811
runs-on: ubuntu-latest
912
timeout-minutes: 30
1013

1114
steps:
12-
- uses: actions/checkout@v1
13-
with:
14-
fetch-depth: 10
15+
- uses: actions/checkout@v3
1516
- name: Use Node.js 16.x
16-
uses: actions/setup-node@v1
17+
uses: actions/setup-node@v3
1718
with:
1819
node-version: 16.x
19-
- run: npm install
20+
- run: npm ci
2021
- name: Test Browser
2122
run: npm run test:browser
2223
env:
23-
CI: true
2424
BROWSERSTACK_USER: ${{ secrets.BROWSERSTACK_USER }}
2525
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
26+
- run: npx bundlewatch --config bundlewatch.config.json
27+
env:
28+
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

.github/workflows/ci.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ jobs:
3434
if: matrix.node-version == '16.x'
3535
- run: npm run docs:diff
3636
if: matrix.node-version == '16.x'
37-
- run: npm run bundlewatch
38-
if: matrix.node-version == '16.x'
39-
env:
40-
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
4137
- run: npm run test:node
4238
if: matrix.node-version >= '16.x'
4339
- run: npm run test:pack

0 commit comments

Comments
 (0)