Compare commits
1 Commits
main
...
go-1732-ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a222d46e8c |
27
.githooks/commit-msg
Executable file
27
.githooks/commit-msg
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
# The script below adds the branch name automatically to
|
||||
# every one of your commit messages. The regular expression
|
||||
# below searches for linear issue key's. The issue key will
|
||||
# be extracted out of your branch name
|
||||
|
||||
REGEX_ISSUE_ID="[a-zA-Z0-9]+-[0-9]+"
|
||||
|
||||
# Find current branch name
|
||||
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
|
||||
COMMIT_MSG_FILE=$1
|
||||
COMMIT_TEXT=$(cat "$COMMIT_MSG_FILE")
|
||||
|
||||
if [[ -z "$BRANCH_NAME" ]]; then
|
||||
echo "Commit message validation failed: no branch name!"; exit 1
|
||||
fi
|
||||
|
||||
# Extract issue id from branch name
|
||||
ISSUE_ID=$(echo "$BRANCH_NAME" | grep -o -E "$REGEX_ISSUE_ID" | head -1 | awk '{print toupper($0)}')
|
||||
|
||||
if [[ "$ISSUE_ID" != "GO-"* ]]; then
|
||||
echo "Commit message validation failed: branch name should contain issue name!"; exit 1
|
||||
fi
|
||||
|
||||
if [[ "$COMMIT_TEXT" != "GO-"* ]]; then
|
||||
echo "$ISSUE_ID" "$COMMIT_TEXT" > "$COMMIT_MSG_FILE"
|
||||
fi
|
||||
17
.githooks/pre-push
Executable file
17
.githooks/pre-push
Executable file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
INSTALL_PYTHON=python3
|
||||
ARGS=(hook-impl --config=.pre-commit-config.yaml --hook-type=pre-push)
|
||||
# end templated
|
||||
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
ARGS+=(--hook-dir "$HERE" -- "$@")
|
||||
|
||||
if [ -x "$INSTALL_PYTHON" ]; then
|
||||
exec "$INSTALL_PYTHON" -mpre_commit "${ARGS[@]}"
|
||||
elif command -v pre-commit > /dev/null; then
|
||||
exec pre-commit "${ARGS[@]}"
|
||||
else
|
||||
echo '`pre-commit` not found. Please visit https://wiki.anytype.io/doc/mandatory-git-hooks-5rQt1Qyw7k ' 1>&2
|
||||
exit 1
|
||||
fi
|
||||
20
.github/workflows/coverage.yml
vendored
20
.github/workflows/coverage.yml
vendored
@ -3,6 +3,10 @@ on:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
@ -32,6 +36,21 @@ jobs:
|
||||
${{ runner.os }}-go-${{ matrix.go-version }}-
|
||||
# }}
|
||||
|
||||
- name: Setup license repository
|
||||
uses: actions/checkout@master
|
||||
with:
|
||||
repository: anyproto/open
|
||||
ref: refs/heads/main
|
||||
path: ./open
|
||||
- name: Check licenses
|
||||
run: |
|
||||
cd open
|
||||
python3 tools/generate.py --platform golang
|
||||
cd ..
|
||||
sudo gem install license_finder
|
||||
license_finder inherited_decisions add open/decisions.yml
|
||||
license_finder --enabled-package-managers gomodules
|
||||
|
||||
- name: deps
|
||||
run: make deps
|
||||
|
||||
@ -55,3 +74,4 @@ jobs:
|
||||
echo "Failed"
|
||||
exit 1
|
||||
fi
|
||||
- uses: seriousben/go-patch-cover-action@v1
|
||||
|
||||
5
.pre-commit-config.yaml
Normal file
5
.pre-commit-config.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
repos:
|
||||
- repo: https://github.com/zricethezav/gitleaks
|
||||
rev: v8.16.0
|
||||
hooks:
|
||||
- id: gitleaks
|
||||
Loading…
x
Reference in New Issue
Block a user