-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/github_actions/guibranco/github-i…
…nfisical-secrets-check-action-1.1.24
- Loading branch information
Showing
7 changed files
with
267 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
LC_ALL=C | ||
|
||
local_branch="$(git rev-parse --abbrev-ref HEAD)" | ||
|
||
valid_branch_regex="^(penify|gitauto|dependabot|feature|fix|docs|style|refactor|perf|hotfix|test|chore|create)(\/[a-zA-Z0-9#._-]+)+$" | ||
|
||
message="There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex. Your commit will be rejected. You should rename your branch to a valid name and try again." | ||
|
||
if [[ ! $local_branch =~ $valid_branch_regex ]] | ||
then | ||
echo "$message" | ||
exit 1 | ||
fi | ||
|
||
#npm run lint |
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,39 @@ | ||
#!/bin/sh | ||
|
||
# This script generates an AI-powered commit message using dotnet-aicommitmessage. | ||
# It can be bypassed by setting the GIT_AICOMMIT_SKIP environment variable. | ||
|
||
# Exit immediately if GIT_AICOMMIT_SKIP is set | ||
if [ -n "$GIT_AICOMMIT_SKIP" ]; then | ||
exit 0 | ||
fi | ||
|
||
if ! command -v dotnet-aicommitmessage &> /dev/null; then | ||
echo "Error: dotnet-aicommitmessage is not installed or not in PATH" >&2 | ||
echo "Please install it by running 'dotnet tool install -g aicommitmessage'" >&2 | ||
exit 1 | ||
fi | ||
|
||
COMMIT_MSG_FILE=$1 | ||
CURRENT_MESSAGE=$(cat "$COMMIT_MSG_FILE") | ||
|
||
# From version 0.6.1, this is not needed anymore. | ||
# GIT_DIFF=$(git diff --staged) | ||
# GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) | ||
|
||
# Run dotnet-aicommitmessage with error handling | ||
# From version 0.6.1 branch and diff are now retrieved by the tool and don't need to be passed manually. | ||
# Version 0.6.1 and higher: dotnet-aicommitmessage generate-message -m "$CURRENT_MESSAGE" | ||
# Version 0.6.0 and lower: dotnet-aicommitmessage generate-message -m "$CURRENT_MESSAGE" -b "$GIT_BRANCH_NAME" -d "$GIT_DIFF" | ||
|
||
if ! AI_MESSAGE=$(dotnet-aicommitmessage generate-message -m "$CURRENT_MESSAGE"); then | ||
echo "Error: Failed to generate AI commit message. Using original message." >&2 | ||
exit 0 | ||
fi | ||
|
||
if [[ -z "$AI_MESSAGE" || "$AI_MESSAGE" =~ ^[[:space:]]*$ ]]; then | ||
echo "Error: Generated commit message is empty." >&2 | ||
exit 1 | ||
fi | ||
echo "$AI_MESSAGE" > "$COMMIT_MSG_FILE" | ||
exit 0 |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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.