Skip to content

Commit afdb6eb

Browse files
authored
Merge pull request #3 from testsnake/dev
Workflow integration
2 parents da2b3e2 + 20d134f commit afdb6eb

File tree

5 files changed

+96
-20
lines changed

5 files changed

+96
-20
lines changed

.github/workflows/auto-format.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Auto-Format on PR Merge
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- main
8+
9+
jobs:
10+
format-and-commit:
11+
runs-on: ubuntu-latest
12+
if: github.event.pull_request.merged == true
13+
steps:
14+
- uses: actions/checkout@v3
15+
with:
16+
ref: ${{ github.event.pull_request.head.ref }}
17+
fetch-depth: 0
18+
persist-credentials: true
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: '21'
24+
cache: 'npm'
25+
26+
- name: Install dependencies
27+
run: npm install
28+
29+
- name: Run Prettier
30+
run: npm run format
31+
32+
- name: Check for changes
33+
id: git-check
34+
run: |
35+
if git diff --exit-code; then
36+
echo "::set-output name=changes::false"
37+
else
38+
echo "::set-output name=changes::true"
39+
fi
40+
41+
- name: Commit and Push changes
42+
if: steps.git-check.outputs.changes == 'true'
43+
uses: stefanzweifel/git-auto-commit-action@v4
44+
with:
45+
commit_message: '[AUTO] Apply code formatting'
46+
branch: main
47+
file_pattern: src/**/*.*

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: '21'
21+
cache: 'npm'
22+
23+
- name: Install dependencies
24+
run: npm install
25+
26+
- name: Check if project compiles
27+
run: npm run build

.github/workflows/dependency-review.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
1010
name: 'Dependency review'
1111
on:
12-
pull_request:
13-
branches: [ "main" ]
12+
pull_request:
13+
branches: ['main']
1414

1515
# If using a dependency submission action in this workflow this permission will need to be set to:
1616
#
@@ -19,21 +19,21 @@ on:
1919
#
2020
# https://docs.github.com/en/enterprise-cloud@latest/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api
2121
permissions:
22-
contents: read
23-
# Write permissions for pull-requests are required for using the `comment-summary-in-pr` option, comment out if you aren't using this option
24-
pull-requests: write
22+
contents: read
23+
# Write permissions for pull-requests are required for using the `comment-summary-in-pr` option, comment out if you aren't using this option
24+
pull-requests: write
2525

2626
jobs:
27-
dependency-review:
28-
runs-on: ubuntu-latest
29-
steps:
30-
- name: 'Checkout repository'
31-
uses: actions/checkout@v4
32-
- name: 'Dependency Review'
33-
uses: actions/dependency-review-action@v4
34-
# Commonly enabled options, see https://github.com/actions/dependency-review-action#configuration-options for all available options.
35-
with:
36-
comment-summary-in-pr: always
37-
# fail-on-severity: moderate
38-
# deny-licenses: GPL-1.0-or-later, LGPL-2.0-or-later
39-
# retry-on-snapshot-warnings: true
27+
dependency-review:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: 'Checkout repository'
31+
uses: actions/checkout@v4
32+
- name: 'Dependency Review'
33+
uses: actions/dependency-review-action@v4
34+
# Commonly enabled options, see https://github.com/actions/dependency-review-action#configuration-options for all available options.
35+
with:
36+
comment-summary-in-pr: always
37+
# fail-on-severity: moderate
38+
# deny-licenses: GPL-1.0-or-later, LGPL-2.0-or-later
39+
# retry-on-snapshot-warnings: true

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ package.json
55
package-lock.json
66
pnpm-lock.yaml
77
tsconfig.json
8-
.vscode
8+
.vscode
9+
*.md

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"build": "tsc && npm run copyLocales",
1111
"start": "node ./build/index.js",
1212
"build:dev": "npm run clean && npm run build",
13-
"build:start": "npm run clean && npm run build && npm run start"
13+
"build:start": "npm run clean && npm run build && npm run start",
14+
"format": "prettier --write ."
1415
},
1516
"repository": {
1617
"type": "git",

0 commit comments

Comments
 (0)