diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..5471147d --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,36 @@ +# Configuration for release-drafter action +name: Release Drafter +on: + push: + branches: + - main + - master + pull_request: + types: + - opened + - reopened + - synchronize + - edited + +jobs: + release-drafter: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 14 + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Release Drafter + uses: release-drafter/release-drafter@v5 + with: + config-file: .github/release-drafter.yml diff --git a/scripts/githooks/commit-msg.sh b/scripts/githooks/commit-msg.sh index e5c36474..878795f3 100644 --- a/scripts/githooks/commit-msg.sh +++ b/scripts/githooks/commit-msg.sh @@ -19,6 +19,8 @@ # enforce checking for proper commit message format before actual commits. # You may need to make the scripts executable by 'chmod +x .git/hooks/commit-msg'. +. ./.github/release-drafter.yml + # commit-msg use go-gitlint tool, install go-gitlint via `go get github.com/llorllale/go-gitlint/cmd/go-gitlint` # go-gitlint --msg-file="$1" @@ -62,7 +64,7 @@ GITLINT_DIR="$OPENIM_ROOT/_output/tools/go-gitlint" $GITLINT_DIR \ --msg-file=$1 \ --target='go-gitlint' \ - --subject-regex="^(build|chore|ci|docs|feat|feature|fix|perf|refactor|revert|style|bot|test)(.*)?:\s?.*" \ + --subject-regex="^(build|chore|ci|docs|feat|feature|fix|perf|refactor|revert|style|bot|test)(.*)?:\s*(main|master)?\s?.*" \ --subject-maxlen=150 \ --subject-minlen=10 \ --body-regex=".*" \ diff --git a/scripts/githooks/pre-commit.sh b/scripts/githooks/pre-commit.sh index 9ffeb28f..5185ffe4 100644 --- a/scripts/githooks/pre-commit.sh +++ b/scripts/githooks/pre-commit.sh @@ -25,7 +25,7 @@ chmod +x scripts/githooks/pre-commit.sh # ============================================================================== # This is a pre-commit hook that ensures attempts to commit files that are chmod +x scripts/githooks/pre-commit.sh -# are larger than $limit to your _local_ repo fail, with a helpful error message. +# are larger than $limit to your _local_ repo, with a helpful error message. # You can override the default limit of 2MB by supplying the environment variable: # GIT_FILE_SIZE_LIMIT=2000000 git commit -m "test: this commit is allowed file sizes up to 50MB" @@ -105,7 +105,7 @@ if $shouldFail then printMessage "If you really need to commit this file, you can override the size limit by setting the GIT_FILE_SIZE_LIMIT environment variable, e.g. GIT_FILE_SIZE_LIMIT=20000000 for 20MB. Or, commit with the --no-verify switch to skip the check entirely." printError "Commit aborted" - exit 1; + .git diff-index --cached --name-only $against .github/release-drafter.yml fi if [[ ! $local_branch =~ $valid_branch_regex ]]