mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-10-11 03:13:35 +00:00
feat: add workflow for prettifier
This commit is contained in:
6 files changed
+96
-4
No files matched your search
@@ -0,0 +1,51 @@
|
||||
name: Prettifier
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * 0" # Runs every week on Sunday
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
actions: write
|
||||
|
||||
jobs:
|
||||
prettify:
|
||||
name: Prettify JSON files
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
|
||||
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
|
||||
- run: npm ci
|
||||
|
||||
- name: Run the prettifier and open a PR if it changed something
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
git config --global user.email "actions@github.com"
|
||||
git config --global user.name "GitHub Actions"
|
||||
|
||||
BRANCH="prettify-json-files"
|
||||
|
||||
git push origin --delete "$BRANCH" 2>/dev/null || true
|
||||
|
||||
git checkout -b "$BRANCH"
|
||||
npx prettier . --write
|
||||
|
||||
if git diff --quiet && git diff --cached --quiet; then
|
||||
echo "No formatting changes needed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git add .
|
||||
COUNT=$(git status -s -uno | wc -l)
|
||||
git commit -m "chore(domains): prettify all json files"
|
||||
git push --set-upstream origin "$BRANCH"
|
||||
|
||||
gh pr create -l maintainer -t "chore(domains): prettify all json files" -b "$COUNT file(s) have been modified."
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
@@ -2,7 +2,7 @@ name: Stale
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 12 * * *"
|
||||
- cron: "0 12 * * *" # Runs at 12:00
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
*.md
|
||||
.github
|
||||
media
|
||||
tests/*
|
||||
util/*
|
||||
*.js
|
||||
package*.json
|
||||
.prettier*
|
||||
.gitignore
|
||||
LICENSE
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"trailingComma": "none",
|
||||
"overrides": [
|
||||
{
|
||||
"files": "*.json",
|
||||
"options": {
|
||||
"parser": "json",
|
||||
"printWidth": 1,
|
||||
"tabWidth": 4
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Generated
+18
-1
@@ -6,7 +6,8 @@
|
||||
"": {
|
||||
"devDependencies": {
|
||||
"ava": "^8.0.1",
|
||||
"fs-extra": "^11.4.0"
|
||||
"fs-extra": "^11.4.0",
|
||||
"prettier": "3.9.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@cto.af/wtf8": {
|
||||
@@ -1405,6 +1406,22 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "3.9.6",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.6.tgz",
|
||||
"integrity": "sha512-OpN0zzVdiaiAhxpuuj5efpIS4sY9j7bY6uR5mnj5yPzGkdkjNKSJeUThPb60Jw29QuAZgA4o+/iB49kFiaBX6g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"prettier": "bin/prettier.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/pretty-ms": {
|
||||
"version": "9.3.0",
|
||||
"resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-9.3.0.tgz",
|
||||
|
||||
+3
-2
@@ -5,6 +5,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^8.0.1",
|
||||
"fs-extra": "^11.4.0"
|
||||
"fs-extra": "^11.4.0",
|
||||
"prettier": "3.9.6"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user