Skip to content

Commit

Permalink
🧱 Set up husky
Browse files Browse the repository at this point in the history
  • Loading branch information
tiulpin committed Dec 20, 2024
1 parent 6bdac20 commit 72a6355
Show file tree
Hide file tree
Showing 8 changed files with 905 additions and 8 deletions.
76 changes: 76 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Do not commit your actual .env file to Git! This may contain secrets or other
# private information.

# Enable/disable step debug logging (default: `false`). For local debugging, it
# may be useful to set it to `true`.
ACTIONS_STEP_DEBUG=true

# GitHub Actions inputs should follow `INPUT_<name>` format (case-sensitive).
# Hyphens should not be converted to underscores!
INPUT_args=-l,jetbrains/qodana-python
INPUT_results-dir=.github/local/results
INPUT_cache-dir=.github/local/cache
INPUT_artifact-name=default-artifact-name
INPUT_primary-cache-key=""
INPUT_additional-cache-key=""
INPUT_cache-default-branch-only=false
INPUT_upload-result=true
INPUT_use-caches=true
INPUT_use-annotations=false
INPUT_pr-mode=false
INPUT_post-pr-comment=false
INPUT_github-token=${{ secrets.GITHUB_TOKEN }}
INPUT_push-fixes=false
INPUT_commit-message=""
INPUT_use-nightly=false

# QODANA_TOKEN=""

# GitHub Actions default environment variables. These are set for every run of a
# workflow and can be used in your actions. Setting the value here will override
# any value set by the local-action tool.
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables

# CI="true"
# GITHUB_ACTION=""
# GITHUB_ACTION_PATH=""
# GITHUB_ACTION_REPOSITORY=""
# GITHUB_ACTIONS=""
# GITHUB_ACTOR=""
# GITHUB_ACTOR_ID=""
# GITHUB_API_URL=""
# GITHUB_BASE_REF=""
# GITHUB_ENV=""
# GITHUB_EVENT_NAME=""
# GITHUB_EVENT_PATH=""
# GITHUB_GRAPHQL_URL=""
# GITHUB_HEAD_REF=""
# GITHUB_JOB=""
# GITHUB_OUTPUT=""
# GITHUB_PATH=""
# GITHUB_REF=""
# GITHUB_REF_NAME=""
# GITHUB_REF_PROTECTED=""
# GITHUB_REF_TYPE=""
# GITHUB_REPOSITORY=""
# GITHUB_REPOSITORY_ID=""
# GITHUB_REPOSITORY_OWNER=""
# GITHUB_REPOSITORY_OWNER_ID=""
# GITHUB_RETENTION_DAYS=""
# GITHUB_RUN_ATTEMPT=""
# GITHUB_RUN_ID=""
# GITHUB_RUN_NUMBER=""
# GITHUB_SERVER_URL=""
# GITHUB_SHA=""
# GITHUB_STEP_SUMMARY=""
# GITHUB_TRIGGERING_ACTOR=""
# GITHUB_WORKFLOW=""
# GITHUB_WORKFLOW_REF=""
# GITHUB_WORKFLOW_SHA=""
# GITHUB_WORKSPACE=""
# RUNNER_ARCH=""
# RUNNER_DEBUG=""
# RUNNER_NAME=""
# RUNNER_OS=""
# RUNNER_TEMP=""
# RUNNER_TOOL_CACHE=""
2 changes: 2 additions & 0 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
cache: npm
- name: Install dependencies
run: npm ci && npm run build
- name: Run commitlint
run: npx commitlint --from HEAD~20 --to HEAD
- name: Rebuild scan/dist/
run: cd scan && npm run package
- name: Compare the expected and actual dist/ directories
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ node_modules
**/node_modules
**/lib
.idea
.vscode
.github/local
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
Expand Down
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no-install commitlint --edit "$1"
1 change: 1 addition & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm ci
34 changes: 34 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2021-2024 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

module.exports = {
parserPreset: {
parserOpts: {
// Extracts the gitmoji as 'type' and the remainder as 'subject'
headerPattern: /^(:\w+:)\s(.*)$/,
headerCorrespondence: ['type', 'subject']
}
},
rules: {
// Disable conventional type checks
'type-enum': [0],
// Ensure there's always a type (gitmoji)
'type-empty': [2, 'never'],
// Ensure there's always a subject after the gitmoji
'subject-empty': [2, 'never'],
// You could add other rules like max length or no trailing period if desired
}
};
Loading

0 comments on commit 72a6355

Please sign in to comment.