Skip to content

Commit

Permalink
Merge pull request #13 from simonkovtyk/ci/changed-workflow
Browse files Browse the repository at this point in the history
ci(workflows): added permission to write to pull requests
  • Loading branch information
simonkovtyk authored Sep 26, 2024
2 parents 851b360 + e951132 commit 5473978
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 19 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,13 @@ jobs:
version: latest
run_install: true

- name: Lint code
run: |
pnpm run lint:eslint
- name: Build
run: pnpm run build
run: pnpm run tsc

- name: Assets
run: |
cp package.json dist/package.json
cp README.md dist/README.md
cp LICENSE dist/LICENSE
- name: Config
env:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pull_request-opened.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Pull request opened

on:
pull_request:
types:
Expand All @@ -10,6 +9,8 @@ on:
jobs:
notify-greet:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Auto assign
uses: actions/github-script@v7
Expand Down
20 changes: 15 additions & 5 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,35 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: NodeJS install
uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Install
- name: pnpm install
uses: pnpm/action-setup@v4
with:
version: latest
run_install: true

- name: Lint code
run: |
pnpm run lint:tsc
pnpm run lint:eslint
pnpm run tsc --noEmit
pnpm run eslint .
- name: Lint commits
if: github.event_name == 'pull_request'
run: |
commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
pnpm run commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
notify_success:
runs-on: ubuntu-latest
needs: style_check

permissions:
pull-requests: write
if: success()
steps:
- name: Comment success
Expand Down Expand Up @@ -65,6 +73,8 @@ jobs:
notify_failure:
runs-on: ubuntu-latest
needs: style_check
permissions:
pull-requests: write
if: failure()
steps:
- name: Comment failure
Expand Down
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npm run lint:commit ${1}
npm run commitlint -- --edit $1
4 changes: 2 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
npm run lint:tsc
npm run lint:eslint
npm run tsc -- --noEmit
npm run eslint -- .
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@
"esbuild": ">=0.20.0"
},
"scripts": {
"lint:commit": "commitlint --edit",
"lint:eslint": "eslint .",
"lint:tsc": "tsc --noEmit",
"build": "tsc"
"commitlint": "commitlint",
"eslint": "eslint",
"tsc": "tsc"
},
"devDependencies": {
"@commitlint/cli": "^19.5.0",
Expand Down

0 comments on commit 5473978

Please sign in to comment.