Skip to content

Commit 1376ecf

Browse files
chore: add format workflow (#441)
1 parent d8d0fbe commit 1376ecf

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

.github/workflows/format.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: 👔 Format
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
format:
14+
if: github.repository == 'eslint-community/eslint-plugin/promise'
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: ⬇️ Checkout repo
19+
uses: actions/checkout@v3
20+
21+
- name: ⎔ Setup node
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: 18
25+
26+
- name: 📥 Install deps
27+
run: npm install
28+
29+
- name: 👔 Format
30+
run: npm run format
31+
32+
- name: 💪 Commit
33+
run: |
34+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
35+
git config --local user.name "github-actions[bot]"
36+
37+
git add .
38+
if [ -z "$(git status --porcelain)" ]; then
39+
echo "💿 no formatting changed"
40+
exit 0
41+
fi
42+
git commit -m "chore: format"
43+
git push
44+
echo "💿 pushed formatting changes https://github.com/$GITHUB_REPOSITORY/commit/$(git rev-parse HEAD)"

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"Aadit M Shah <aaditmshah@aadit.codes> (https://aadit.codes/)"
2323
],
2424
"scripts": {
25-
"format": "prettier --write .",
25+
"format": "prettier --write . && npm run lint -- --fix",
2626
"lint": "npm-run-all \"lint:*\"",
2727
"lint:eslint-docs": "npm run update:eslint-docs && git diff --exit-code",
2828
"lint:js": "eslint --report-unused-disable-directives .",

0 commit comments

Comments
 (0)