-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: adds linting and formatting jobs to on pull request workflow (#168)
* ci: adds formatting and pr title linting to pull request CI also removes beachball check and build steps * chore: removes pretty-quick and husky since their uses is no longer required * ci: fixes issue where failing the format job didnt result in a job failure * chore: removes unused codeowners file * ci: fixes issue where pr title check didnt run if PR was never edited * ci: run title check on sync as well * chore: updates lint and format commands to run against tests * chore: ignore generated code for linting and formatting * chore: fixes eslint config file to follow v8.x structure * ci: fixes bug where formatting was not returning the correct error code
- Loading branch information
Showing
8 changed files
with
79 additions
and
266 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
This file was deleted.
Oops, something went wrong.
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,37 +1,41 @@ | ||
name: Run Tests on PR | ||
name: Lint, Format, and Test | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
workflow_call: | ||
workflow_dispatch: | ||
pull_request: | ||
|
||
env: | ||
API_KEY: ${{ secrets.API_KEY }} | ||
APP_ID: ${{ secrets.APP_ID }} | ||
APP_TOKEN: ${{ secrets.APP_TOKEN }} | ||
EXAMPLE_USER_ID: ${{ secrets.EXAMPLE_USER_ID }} | ||
PUBLIC_KEY: ${{ secrets.PUBLIC_KEY }} | ||
API_KEY: ${{ secrets.API_KEY }} | ||
APP_ID: ${{ secrets.APP_ID }} | ||
APP_TOKEN: ${{ secrets.APP_TOKEN }} | ||
EXAMPLE_USER_ID: ${{ secrets.EXAMPLE_USER_ID }} | ||
|
||
jobs: | ||
publish: | ||
name: Run Tests on PR | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Dependencies | ||
run: npm i | ||
|
||
- name: ESLint Check | ||
run: npm run lint:ci | ||
|
||
- name: Beachball Check | ||
run: | | ||
npm run beachball-check | ||
- name: Build | ||
run: npm run set-version && npm run build | ||
|
||
- name: Unit Test | ||
run: npm run test | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install dependencies | ||
run: npm i | ||
- name: Lint | ||
run: npm run lint:ci | ||
format: | ||
name: Format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install dependencies | ||
run: npm i | ||
- name: Format | ||
run: npm run format:ci | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install dependencies | ||
run: npm i | ||
- name: Test | ||
run: npm run test |
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,37 @@ | ||
name: PR Title Check | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- edited | ||
|
||
jobs: | ||
lint-pr-title: | ||
name: Lint PR Title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/action-semantic-pull-request@v5 | ||
id: lint_pr_title | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: marocchino/sticky-pull-request-comment@v2 | ||
# When the previous steps fails, the workflow would stop. By adding this | ||
# condition you can continue the execution with the populated error message. | ||
if: always() && (steps.lint_pr_title.outputs.error_message != null) | ||
with: | ||
header: pr-title-lint-error | ||
message: | | ||
Please update the pull request title to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). | ||
Details: | ||
``` | ||
${{ steps.lint_pr_title.outputs.error_message }} | ||
``` | ||
# Delete a previous comment when the issue has been resolved | ||
- if: ${{ steps.lint_pr_title.outputs.error_message == null }} | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
header: pr-title-lint-error | ||
delete: true |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -3,4 +3,4 @@ node_modules/ | |
coverage/ | ||
.DS_STORE | ||
lib/ | ||
generated/ | ||
src/generated/ |
Oops, something went wrong.