-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (48 loc) · 2.19 KB
/
dependabot.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
# Automatically save updated `pnpm-lock.yaml` file for dependabot PRs.
# This is necessary because dependabot doesn't support pnpm yet:
# https://github.com/dependabot/dependabot-core/issues/1736
#
# Note: We use the `pull_request_target` event due to GitHub security measures.
# It is important to ensure we don't execute any untrusted PR code in this context.
# See: https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests
name: Dependabot
on:
- pull_request_target
jobs:
fix-lockfile:
runs-on: ubuntu-latest
if: |
github.actor == 'dependabot[bot]' &&
contains(github.event.pull_request.head.ref, 'dependabot/npm_and_yarn/')
steps:
- uses: actions/[email protected]
with:
# Using a Personal Access Token here is required to trigger workflows on our new commit.
# The default GitHub token doesn't trigger any workflows.
# See: https://github.community/t/push-from-action-does-not-trigger-subsequent-action/16854/2
token: ${{ secrets.BOT_GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 2
- uses: pnpm/[email protected]
with:
version: 6.10.0
- uses: actions/[email protected]
with:
node-version: "14"
cache: "pnpm"
- run: git checkout HEAD^ -- pnpm-lock.yaml
- run: pnpm install --ignore-scripts --lockfile-only
- name: Configure git
run: |
# use personal access token to allow triggering new workflow
BASIC_AUTH=$(echo -n "x-access-token:${{ secrets.BOT_GITHUB_TOKEN }}" | base64)
echo "::add-mask::$BASIC_AUTH"
git config --global user.name 'dependabot[bot]'
git config --global user.email '49699333+dependabot[bot]@users.noreply.github.com'
git config --local http.$GITHUB_SERVER_URL/.extraheader "AUTHORIZATION: basic $BASIC_AUTH"
- name: Commit changes
run: |
git add pnpm-lock.yaml
git commit -m "[dependabot skip] Fix pnpm-lock.yaml"
git push