-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (61 loc) · 2.16 KB
/
security.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
# This is a Github Workflow that runs some security check for external users.
name: Security
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
YARN_ENABLE_HARDENED_MODE: true
jobs:
security:
name: Checking Yarn cache's integrity
runs-on: ubuntu-latest
steps:
- if: github.actor == 'snowball-tech-bot' || github.actor == 'renovate[bot]'
name: Checking if user is a trusted bot
run: |
echo "User is a trusted bot user."
echo "IS_BOT_USER=1" >> $GITHUB_ENV
- if: env.IS_BOT_USER != 1
uses: tspascoal/get-user-teams-membership@v3
id: checkIsSnowballEngineeringTeamMember
with:
username: ${{ github.actor }}
team: engineering
GITHUB_TOKEN: ${{ secrets.MACHINE_GITHUB_TOKEN }}
- if: env.IS_BOT_USER || steps.checkIsSnowballEngineeringTeamMember.outputs.isTeamMember == 'true'
name: No need to check Yarn cache's integrity
run: |
echo "The author is a member of the Snowball engineering team or a trusted bot user."
echo "SKIP_INTEGRITY_CHECK=1" >> $GITHUB_ENV
- if: env.SKIP_INTEGRITY_CHECK != 1
uses: actions/checkout@v4
with:
fetch-depth: 0
- if: env.SKIP_INTEGRITY_CHECK != 1
name: Get updated dependencies or lockfile
id: changed-files-specific
uses: tj-actions/changed-files@v45
with:
files: |
.yarn/**
yarn.lock
- if: env.SKIP_INTEGRITY_CHECK != 1 && steps.changed-files-specific.outputs.any_changed != 'true'
name: No need to check Yarn cache's integrity
run: |
echo "There are no updates of dependencies or lockfile."
echo "SKIP_INTEGRITY_CHECK=1" >> $GITHUB_ENV
- if: env.SKIP_INTEGRITY_CHECK != 1
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: yarn
- if: env.SKIP_INTEGRITY_CHECK != 1
name: Checking Yarn cache's integrity
run: yarn install --check-cache --immutable --immutable-cache