Skip to content

Commit eb83192

Browse files
committed
Add action to dedupe Dependabot PRs
1 parent e7ea56c commit eb83192

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Dedupe Dependabot PRs
2+
3+
on:
4+
push:
5+
branches: ['dependabot/**']
6+
7+
jobs:
8+
dedupe:
9+
name: Dedupe Dependabot PRs
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
- name: Cache .yarn/cache
17+
uses: actions/cache@v3
18+
env:
19+
cache-name: yarn-cache
20+
with:
21+
path: .yarn/cache
22+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
23+
restore-keys: |
24+
${{ runner.os }}-${{ env.cache-name }}
25+
26+
- name: Use Node.js
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: '16'
30+
31+
- name: Enable Corepack
32+
run: corepack enable
33+
34+
- name: Configure Git
35+
run: |
36+
git config user.name 'github-actions[bot]'
37+
git config user.email 'github-actions[bot]@users.noreply.github.com'
38+
39+
- name: Detect working directory
40+
run: |
41+
echo "WORKING_DIRECTORY=$(git log -1 --pretty=%B | sed -n 's/.* in \(\/.*\)$/\1/p')" >> $GITHUB_ENV
42+
43+
- name: Dedupe dependencies
44+
run: yarn dedupe
45+
working-directory: ${{ env.WORKING_DIRECTORY }}
46+
env:
47+
HUSKY: 0
48+
49+
- name: Commit changes
50+
run: |
51+
git add .
52+
git commit -m 'Dedupe dependencies'
53+
working-directory: ${{ env.WORKING_DIRECTORY }}
54+
55+
- name: Push changes
56+
run: git push
57+
working-directory: ${{ env.WORKING_DIRECTORY }}

0 commit comments

Comments
 (0)