Skip to content

Commit 00ed12d

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

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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: Detect working directory
32+
run: |
33+
echo "WORKING_DIRECTORY=$(git log -1 --pretty=%B | sed -n 's/.* in \(\/.*\)$/\1/p')" >> $GITHUB_ENV
34+
35+
- name: Enable Corepack
36+
run: corepack enable
37+
working-directory: ${{ env.WORKING_DIRECTORY }}
38+
39+
- name: Configure Git
40+
run: |
41+
git config user.name 'github-actions[bot]'
42+
git config user.email 'github-actions[bot]@users.noreply.github.com'
43+
working-directory: ${{ env.WORKING_DIRECTORY }}
44+
45+
- name: Install dependencies
46+
run: |
47+
yarn -v
48+
yarn --immutable
49+
working-directory: ${{ env.WORKING_DIRECTORY }}
50+
env:
51+
HUSKY: 0
52+
53+
- name: Dedupe dependencies
54+
run: |
55+
yarn -v
56+
yarn dedupe
57+
working-directory: ${{ env.WORKING_DIRECTORY }}
58+
59+
- name: Commit changes
60+
run: |
61+
git add .
62+
git commit -m 'Dedupe dependencies'
63+
working-directory: ${{ env.WORKING_DIRECTORY }}
64+
65+
- name: Push changes
66+
run: git push
67+
working-directory: ${{ env.WORKING_DIRECTORY }}

0 commit comments

Comments
 (0)