Skip to content

Commit dfb0b02

Browse files
authored
Merge pull request #110 from actions/JamesMGreene-patch-1
Add a workflow to rebuild the distributables for Dependabot PRs
2 parents f0b70b4 + 8020830 commit dfb0b02

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Rebuild distributables for Dependabot PRs
2+
3+
on:
4+
push:
5+
branches:
6+
- 'dependabot/npm**'
7+
8+
permissions:
9+
contents: write
10+
11+
# This allows a subsequently queued workflow run to interrupt previous runs
12+
concurrency:
13+
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
14+
cancel-in-progress: true
15+
16+
jobs:
17+
rebuild-dist:
18+
if: ${{ github.event.sender.login == 'dependabot[bot]' }}
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
24+
- name: Setup Node.JS
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: 16.x
28+
cache: 'npm'
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Rebuild the dist/ directory
34+
run: npm run prepare
35+
36+
- name: Commit any differences present in the dist/ directory
37+
run: |
38+
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
39+
echo "Detected uncommitted changes after rebuild in dist folder. Committing..."
40+
git add dist/
41+
git config --local user.name "github-actions[bot]"
42+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
43+
git commit -m "Update distributables after Dependabot 🤖"
44+
echo "Pushing branch ${{ github.ref_name }}"
45+
git push origin ${{ github.ref_name }}
46+
fi

0 commit comments

Comments
 (0)