Skip to content

Commit

Permalink
chore: add format workflow (#441)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey authored Jul 19, 2024
1 parent d8d0fbe commit 1376ecf
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
44 changes: 44 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: 👔 Format

on:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
format:
if: github.repository == 'eslint-community/eslint-plugin/promise'
runs-on: ubuntu-latest

steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version: 18

- name: 📥 Install deps
run: npm install

- name: 👔 Format
run: npm run format

- name: 💪 Commit
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
if [ -z "$(git status --porcelain)" ]; then
echo "💿 no formatting changed"
exit 0
fi
git commit -m "chore: format"
git push
echo "💿 pushed formatting changes https://github.com/$GITHUB_REPOSITORY/commit/$(git rev-parse HEAD)"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"Aadit M Shah <aaditmshah@aadit.codes> (https://aadit.codes/)"
],
"scripts": {
"format": "prettier --write .",
"format": "prettier --write . && npm run lint -- --fix",
"lint": "npm-run-all \"lint:*\"",
"lint:eslint-docs": "npm run update:eslint-docs && git diff --exit-code",
"lint:js": "eslint --report-unused-disable-directives .",
Expand Down

0 comments on commit 1376ecf

Please sign in to comment.