Skip to content

Commit 51ac59b

Browse files
Trotttargos
authored andcommitted
build: add GitHub Action to update tools modules
Update ESLint, Babel, remark, and so on. Run once a week. PR-URL: #40644 Reviewed-By: Antoine du Hamel <[email protected]>
1 parent af152a4 commit 51ac59b

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/tools.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "tools update"
2+
on:
3+
schedule:
4+
# Run once a week at 00:05 AM UTC on Saturday.
5+
- cron: '5 0 * * 6'
6+
7+
workflow_dispatch:
8+
9+
jobs:
10+
tools_update:
11+
if: github.repository == 'nodejs/node'
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false # Prevent other jobs from aborting if one fails
15+
matrix:
16+
include:
17+
- id: eslint
18+
run: |
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 --omit=dev --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
44+
steps:
45+
- uses: actions/checkout@v2
46+
- run: ${{ matrix.run }}
47+
- uses: gr2m/create-or-update-pull-request-action@v1 # Create a PR or update the Action's existing PR
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
50+
with:
51+
author: Node.js GitHub Bot <[email protected]>
52+
body: "This is an automated update of ${{ matrix.id }} to ${{ env.NEW_VERSION }}."
53+
branch: "actions/tools-update-${{ matrix.id }}" # Custom branch *just* for this Action.
54+
commit-message: "tools: update ${{ matrix.id }} to ${{ env.NEW_VERSION }}"
55+
labels: tools
56+
title: "tools: update ${{ matrix.id }} to ${{ env.NEW_VERSION }}"

0 commit comments

Comments
 (0)