-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(github): yarn lint job now fails if formatting was needed
If someone sends a pull request that isn't formatted according to the tools we have in place for auto-format code (ESLint, prettier) then after this change the CI will fail and this way we don't end up in a situation where running `yarn lint` on the main branch produces a diff of auto-formatted code files (which is currently sadly the case). At the same time as introducing this constraint I'm also applying the automatic formatting on the code project wide so that the check can actually pass as intended when this change is getting merged. Signed-off-by: Peter Somogyvari <[email protected]>
- Loading branch information
Showing
11 changed files
with
707 additions
and
525 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 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 |
---|---|---|
|
@@ -231,7 +231,47 @@ jobs: | |
restore-keys: | | ||
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} | ||
- run: ./tools/ci.sh | ||
- run: git status --porcelain | ||
- run: git status --porcelain | wc -l | ||
- run: yarn lint | ||
- run: git status --porcelain | ||
- run: git status --porcelain | wc -l | ||
|
||
- name: Set env.GIT_INDEX_FILE_COUNT | ||
id: set_env_git_index_file_count | ||
run: | | ||
echo "GIT_INDEX_FILE_COUNT=$(git status --porcelain | wc -l)" >> "$GITHUB_ENV" | ||
- name: Print env.GIT_INDEX_FILE_COUNT | ||
id: print_env_git_index_file_count | ||
run: | | ||
echo "${{ env.GIT_INDEX_FILE_COUNT }}" | ||
- uses: actions/[email protected] | ||
id: set-result-git_index_file_count | ||
with: | ||
script: | | ||
const { GIT_INDEX_FILE_COUNT } = process.env; | ||
console.log(`env.GIT_INDEX_FILE_COUNT ${GIT_INDEX_FILE_COUNT}`); | ||
return parseInt(GIT_INDEX_FILE_COUNT, 10); | ||
result-encoding: string | ||
|
||
- name: Get result Git Index File Count | ||
id: get_result_git_index_file_count | ||
run: echo "${{steps.set-result-git_index_file_count.outputs.result}}" | ||
|
||
- name: Check Lint Side-effects | ||
if: ${{ steps.set-result-git_index_file_count.outputs.result != 0 }} | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
const failMsg = "yarn lint script produced version control " + | ||
"side-effects: source files have been changed by it that are " + | ||
"otherwise are under version control. " + | ||
"This means (99% of the time) that you need to run the " + | ||
"yarn lint script locally and then include the changes it " + | ||
"makes in your own commit when submitting your pull request."; | ||
core.setFailed(failMsg) | ||
yarn_codegen: | ||
continue-on-error: false | ||
env: | ||
|
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 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 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 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 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
Oops, something went wrong.