Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More CI updates #4

Merged
merged 7 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto encoding=UTF-8
* text=auto eol=lf
38 changes: 38 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Format

on:
issue_comment:
types: [created]

jobs:
format:
if: github.event.issue.pull_request && contains(github.event.comment.body, '/format')
runs-on: ubuntu-latest

permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: '20.x'

- name: Format Code
working-directory: ./ui
run: |
npm install
npx prettier --write .

# Commit changes from prettier
- uses: stefanzweifel/git-auto-commit-action@v5
333fred marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 3 additions & 1 deletion .github/workflows/main-push-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -27,3 +27,5 @@ jobs:
run: |
npm install
npm run build
npx prettier --check .

15 changes: 15 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok adding this as long as it doesn't interfere with other users' settings. (I'm guessing it doesn't, and I've seen .vscode/settings.json tracked before...)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workspace-specific settings override global settings, so if you've set up your own formatter, it will be overridden. I'm ok with that because CI will fail if you haven't formatted as prettier would.

// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"vitest.explorer",
"esbenp.prettier-vscode",
"svelte.svelte-vscode"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [

]
}
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"svelte.enable-ts-plugin": true
}
Loading