diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7b0da70..85646ca 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,7 +2,7 @@ name: Deploy on: push: branches: - - release + - main jobs: deploy: @@ -20,7 +20,7 @@ jobs: - name: Lint run: | tsc --noEmit - pnpm run lint:husky + pnpx eslint . - name: Build run: tsc diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml deleted file mode 100644 index 190a4cd..0000000 --- a/.github/workflows/pull-request.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Pull request checks -on: - pull_request: - types: - - opened - - reopened - branches: - - main - -jobs: - pull_request: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install - uses: pnpm/action-setup@v4 - with: - version: latest - run_install: true - - - name: TypeScript Compiler - run: tsc --noEmit - - - name: Lint - run: pnpx eslint . diff --git a/.github/workflows/pull_request-opened.yml b/.github/workflows/pull_request-opened.yml new file mode 100644 index 0000000..56631eb --- /dev/null +++ b/.github/workflows/pull_request-opened.yml @@ -0,0 +1,29 @@ +name: Pull request opened + +on: + pull_request: + types: + - opened + branches: + - main + +jobs: + notify-greet: + runs-on: ubuntu-latest + steps: + - name: Greet + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: `### 🎉 Welcome! + + Thank you for your contribution and for opening this pull request. + + ### 📖 Contribution Guidelines + + For more details on how to contribute effectively, please refer to our [How to Contribute](https://github.com/simonkovtyk/esbuild-plugin-package-json/blob/main/docs/guides/HOW_TO_CONTRIBUTE.md) document.` + }); diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..ad2321c --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,84 @@ +name: Pull request checks + +on: + pull_request: + types: + - opened + - reopened + - synchronize + branches: + - main + +jobs: + style_check: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install + uses: pnpm/action-setup@v4 + with: + version: latest + run_install: true + + - name: Lint + run: | + tsc --noEmit + pnpx eslint . + notify_success: + runs-on: ubuntu-latest + needs: style_check + if: success() + steps: + - name: Comment success + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: `### ✅ Successful Review + + Great news! Your pull request has been successfully reviewed, and no errors were found. + + ### ⏳ Next Steps + + The author will review the changes shortly, and we look forward to merging your contributions into the project. Thank you for your hard work and dedication! 🎉` + }); + + github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: ["ci-success"] + }); + notify_failure: + runs-on: ubuntu-latest + needs: style_check + if: failure() + steps: + - name: Comment failure + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: `### ⚠️ Review Required + + Thank you for your contribution! Upon review, we've identified some issues in the pull request that need to be addressed. Please take a moment to review the errors and make the necessary adjustments before we can proceed with the integration. + + ### 🛠️ Next Steps + + Feel free to reach out if you have any questions or need assistance. We appreciate your effort in improving our codebase! 🙏` + }); + + github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: ["ci-failure"] + }); diff --git a/LICENSE b/LICENSE index 465a665..31895db 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Simon +Copyright (c) 2024 Simon Kovtyk Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 275ba98..9304504 100644 --- a/package.json +++ b/package.json @@ -62,8 +62,5 @@ "typescript-eslint": "^8.6.0", "@stylistic/eslint-plugin": "^2.8.0", "husky": "^9.1.6" - }, - "scripts": { - "lint:husky": "husky" } }