-
Notifications
You must be signed in to change notification settings - Fork 407
72 lines (67 loc) · 2.72 KB
/
Copy pathdependabot-automation.yml
File metadata and controls
72 lines (67 loc) · 2.72 KB
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
name: 'Dependabot Automation'
on:
pull_request:
types:
- opened
env:
GROUPS: '["dev-minor-and-patch-dependencies", "gh-actions-packages", "test-versions"]'
jobs:
dependabot:
if: github.event.pull_request.user.login == 'dependabot[bot]'
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
id: octo-sts
with:
scope: DataDog/dd-trace-js
policy: dependabot-automation
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@08eff52bf64351f401fb50d4972fa95b9f2c2d1b # 2.4.0
with:
github-token: "${{ steps.octo-sts.outputs.token }}"
- name: Enable auto-merge for Dependabot PRs
if: contains(fromJSON(env.GROUPS), steps.metadata.outputs.dependency-group)
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
- name: Approve a PR
if: contains(fromJSON(env.GROUPS), steps.metadata.outputs.dependency-group)
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
vendor:
if: github.event.pull_request.user.login == 'dependabot[bot]'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@08eff52bf64351f401fb50d4972fa95b9f2c2d1b # 2.4.0
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
if: steps.metadata.outputs.dependency-group == 'vendor-minor-and-patch-dependencies'
- run: yarn
working-directory: ./vendor
if: steps.metadata.outputs.dependency-group == 'vendor-minor-and-patch-dependencies'
- name: Create commits
id: create-commits
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add -A
git commit -m "update vendored dependencies with new versions"
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
if: steps.metadata.outputs.dependency-group == 'vendor-minor-and-patch-dependencies'
- name: Push commits
uses: DataDog/commit-headless@5a0f3876e0fbdd3a86b3e008acf4ec562db59eee # action/v2.0.1
with:
branch: ${{ github.ref_name }}
command: push
commits: "${{ steps.create-commits.outputs.commits }}"
if: steps.metadata.outputs.dependency-group == 'vendor-minor-and-patch-dependencies'