This repository has been archived by the owner on Feb 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add automatic Prettier GitHub action
- Loading branch information
1 parent
e07f595
commit ae02ae6
Showing
10 changed files
with
86 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Prettier | ||
|
||
# This action works with pull requests and pushes | ||
on: | ||
- push | ||
|
||
jobs: | ||
prettier: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
# Make sure the actual branch is checked out when running on pull requests | ||
ref: ${{ github.head_ref }} | ||
|
||
# Make sure @sourcegraph/prettierrc is installed | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
cache: yarn | ||
run: yarn | ||
|
||
- name: Read package.json | ||
id: read_package_json | ||
run: | | ||
JSON=$(cat package.json) | ||
echo "::set-output name=packageJson::${JSON//'%'/'%25'}" | ||
- name: Prettier | ||
uses: creyD/prettier_action@v3.3 | ||
with: | ||
# Take prettier version from package.json to stay in sync and support upgrades through Renovate | ||
prettier_version: ${{fromJson(steps.read_package_json.outputs.packageJson).devDependencies.prettier}} | ||
prettier_options: --write '**/*.{js,css,scss,ts,tsx,md,html,yml,yaml,json}' | ||
commit_message: Prettier | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
.DS_Store | ||
yarn.lock | ||
.yarn-integrity | ||
node_modules | ||
docs/server/config/site.md | ||
.idea | ||
/.bin/ | ||
.vscode/settings.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
website/.cache/ | ||
website/public/ | ||
|
||
# Prettier chokes on Go template syntax | ||
_resources/templates/ | ||
|
||
# Old blog content | ||
blogposts/201?/ | ||
blogposts/2020/ | ||
blogposts/liveblogs/dotgo/ | ||
blogposts/liveblogs/github-universe/ | ||
blogposts/liveblogs/gophercon/ | ||
blogposts/liveblogs/graphql-summit/ | ||
blogposts/liveblogs/strange-loop/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["esbenp.prettier-vscode", "EditorConfig.EditorConfig"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"prettier": "prettier --write '**/*.{js,css,scss,ts,tsx,md,html,yml,yaml,json}' --list-different", | ||
"prettier-check": "yarn run prettier --write=false" | ||
}, | ||
"devDependencies": { | ||
"@sourcegraph/prettierrc": "^3.0.3", | ||
"prettier": "^2.3.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require('./website/node_modules/@sourcegraph/prettierrc') | ||
module.exports = require('@sourcegraph/prettierrc') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
"@sourcegraph/prettierrc@^3.0.3": | ||
version "3.0.3" | ||
resolved "https://registry.npmjs.org/@sourcegraph/prettierrc/-/prettierrc-3.0.3.tgz#51bfa9b2588fe35121593fa877143e6373028289" | ||
integrity sha512-FQ1/Ued4I02R0JkrHHofDN163juVxUnPALzfxPZrDZUHv+c3jHjfZhmTHEz+Wd+g3b7MFk0fkj36nZSnvPyU8A== | ||
|
||
prettier@^2.3.2: | ||
version "2.3.2" | ||
resolved "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d" | ||
integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ== |