Skip to content

Commit 82c2751

Browse files
committed
fixup! build: add GitHub Action to update tools modules
1 parent b86f829 commit 82c2751

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

.github/workflows/tools.yml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,32 @@ jobs:
1515
matrix:
1616
include:
1717
- id: eslint
18-
run: tools/update-eslint.sh
19-
- id: babel-eslint
20-
run: tools/update-babel-eslint.sh
21-
- id: lint-md
2218
run: |
23-
(cd tools/lint-md && rm -rf package-lock.json node_modules && npm install --ignore-scripts)
24-
make lint-md-rollup
19+
cd tools
20+
NEW_VERSION=$(npm view eslint dist-tags.latest)
21+
CURRENT_VERSION=$(node -p "require('./node_modules/eslint/package.json').version")
22+
if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then
23+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
24+
tools/update-eslint.sh
25+
fi
26+
- id: "@babel/eslint-parser"
27+
run: |
28+
cd tools
29+
NEW_VERSION=$(npm view @babel/eslint-parser dist-tags.latest)
30+
CURRENT_VERSION=$(node -p "require('./node_modules/@babel/eslint-parser/package.json').version")
31+
if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then
32+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
33+
tools/update-babel-eslint.sh
34+
fi
35+
- id: "lint-md dependencies"
36+
run: |
37+
cd tools/lint-md
38+
NEW_VERSION=$(npm outdated --parseable | cut -d: -f4 | xargs)
39+
if [ "$NEW_VERSION" != "" ]; then
40+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
41+
rm -rf package-lock.json node_modules && npm install --ignore-scripts)
42+
make lint-md-rollup
43+
fi
2544
steps:
2645
- uses: actions/checkout@v2
2746
- run: ${{ matrix.run }}
@@ -30,8 +49,8 @@ jobs:
3049
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
3150
with:
3251
author: Node.js GitHub Bot <github-bot@iojs.org>
33-
body: "This is an automated update of ${{ matrix.id }} and/or its dependencies."
52+
body: "This is an automated update of ${{ matrix.id }} to ${{ env.NEW_VERSION }}."
3453
branch: "actions/tools-update-${{ matrix.id }}" # Custom branch *just* for this Action.
35-
commit-message: "tools: update ${{ matrix.id }} and/or its dependencies"
54+
commit-message: "tools: update ${{ matrix.id }} to ${{ env.NEW_VERSION }}"
3655
labels: tools
37-
title: "tools: update ${{ matrix.id }} and/or its dependencies"
56+
title: "tools: update ${{ matrix.id }} to ${{ env.NEW_VERSION }}"

0 commit comments

Comments
 (0)