Skip to content

Commit

Permalink
ci: Changes for dependabot to be well-behaved (sourcenetwork#1165)
Browse files Browse the repository at this point in the history
- dependabot PRs are prefixed by `bot`, and their PR title length is not checked
- dependabot runs weekly
- changelog generation configuration is updated to include a `bot` category
  • Loading branch information
orpheuslummis authored Mar 16, 2023
1 parent e89d3d1 commit 50e61a2
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
labels:
- "dependencies"
commit-message:
prefix: "chore"
prefix: "bot"
1 change: 0 additions & 1 deletion .github/workflows/validate-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
runs-on: ubuntu-latest

steps:

- name: Checkout code into the directory
uses: actions/checkout@v3

Expand Down
20 changes: 14 additions & 6 deletions tools/configs/chglog/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ info:
repository_url: https://github.com/sourcenetwork/defradb
options:
commits:
filters:
Type:
- feat
- fix
- perf
- refactor
filters:
Type:
- feat
- fix
- tools
- docs
- perf
- refactor
- test
- ci
- chore
- bot
commit_groups:
title_maps:
feat: Features
Expand All @@ -21,6 +27,7 @@ options:
refactor: Refactoring
test: Testing
ci: Continuous integration
bot: Bot
sort_by: Custom
title_order:
- feat
Expand All @@ -32,6 +39,7 @@ options:
- test
- ci
- chore
- bot
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
Expand Down
3 changes: 3 additions & 0 deletions tools/scripts/scripts_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ TestReturnCode "${T1} 'perf: This is a valid title'" 0;
TestReturnCode "${T1} 'refactor: This is a valid title'" 0;
TestReturnCode "${T1} 'test: This is a valid title'" 0;
TestReturnCode "${T1} 'tools: This is a valid title'" 0;
TestReturnCode "${T1} 'bot: Bump github.com/alternativesourcenetwork/defradb from 1.1.0.1.0.0 to 1.1.0.1.0.1'" 0;
TestReturnCode "${T1} 'bot Bump github.com/alternativesourcenetwork/defradb from 1.1.0.1.0.0 to 1.1.0.1.0.1'" 3;
TestReturnCode "${T1} 'bot Bump github.com/short/short from 1.2.3 to 1.2.4'" 4;
14 changes: 12 additions & 2 deletions tools/scripts/validate-conventional-style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,27 @@ readonly -a VALID_LABELS=("chore"
"perf"
"refactor"
"test"
"tools");
"tools"
"bot");

BOTPREFIX="bot"

if [ "${#}" -ne 1 ]; then
printf "Error: Invalid number of arguments (pass title as 1 string argument).\n";
exit 2;
fi

TITLE=${1};
IS_BOT=false;

# Detect if title is prefixed with `bot`
if [[ "${TITLE}" =~ ^"${BOTPREFIX}:" ]]; then
printf "Info: Title is from a bot, skipping length-related title validation.\n";
IS_BOT=true;
fi

# Validate that the entire length of the title is less than or equal to our character limit.
if [ "${#TITLE}" -gt 60 ]; then
if [ "${#TITLE}" -gt 60 ] && [ "${IS_BOT}" = false ]; then
printf "Error: The length of the title is too long (should be 60 or less).\n";
exit 3;
fi
Expand Down

0 comments on commit 50e61a2

Please sign in to comment.