Skip to content

Commit f35bf6d

Browse files
authored
ci(versioning): skip some commits and checkout release branch (#1573)
# What does this PR do? - checkout release branch (unshallow) - exclude dd-octo-sts author commits - exclude proposal commits
1 parent b09abfb commit f35bf6d

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

.github/workflows/release-proposal-dispatch.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ jobs:
136136
steps:
137137
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
138138
with:
139-
fetch-depth: 0 # Need full history for git tags
139+
ref: ${{ env.RELEASE_BRANCH }}
140+
fetch-depth: 0
141+
fetch-tags: true
140142
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
141143
with:
142144
cache-targets: true
@@ -186,6 +188,14 @@ jobs:
186188
- name: Create a branch for the release proposal
187189
id: proposal-branch
188190
run: |
191+
git status
192+
193+
IS_SHALLOW=$(git rev-parse --is-shallow-repository)
194+
if [ "$IS_SHALLOW" = "true" ]; then
195+
echo "Repository is shallow"
196+
git pull --unshallow
197+
fi
198+
189199
git checkout "${{ env.RELEASE_BRANCH }}"
190200
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
191201
BRANCH_NAME="${{ env.PROPOSAL_BRANCH_PREFIX }}/${{ inputs.crate }}/$TIMESTAMP"
@@ -380,7 +390,6 @@ jobs:
380390
"",
381391
(if $api_info.version then "**Next version:** `\($api_info.version)`\n" else null end),
382392
"**Semver bump:** `\($api_info.level)`",
383-
"",
384393
(if $api_info.tag then "**Tag:** `\($api_info.tag)`\n" else null end),
385394
(if $api_info.initial_release == "true" then
386395
"**Warning:** this is an initial release. Please verify that the version and commits included are correct.\n"

cliff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ commit_parsers = [
8585
{ message = "^feat", group = "<!-- A -->Added" },
8686
{ message = "^fix", group = "<!-- C -->Fixed" },
8787
{ message = "^refactor\\(clippy\\)", skip = true },
88-
{ message = "^chore\\(release\\): prepare for", skip = true },
88+
{ message = "^chore\\(release\\)", skip = true },
8989
{ message = "^chore: Release", skip = true },
9090
{ message = "^chore\\(deps.*\\)", skip = true },
9191
{ message = "^chore\\(pr\\)", skip = true },

scripts/commits-since-release.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ VERBOSE=false
1919
INPUT_JSON=""
2020
# Default patterns to exclude (one per line, checked with grep -E)
2121
EXCLUDE_PATTERNS="^Merge branch
22-
^Merge pull request "
22+
^Merge pull request
23+
^chore\(release\)"
24+
25+
EXCLUDE_AUTHOR="dd-octo-sts\[bot\]"
2326

2427
for arg in "$@"; do
2528
case "$arg" in
@@ -105,6 +108,13 @@ log_verbose() {
105108
# Check if a commit subject should be excluded
106109
should_exclude() {
107110
local subject="$1"
111+
local author="$2"
112+
113+
# Check if author should be excluded
114+
if echo "$author" | grep -qE "$EXCLUDE_AUTHOR"; then
115+
return 0 # Exclude
116+
fi
117+
108118
if [ -z "$EXCLUDE_PATTERNS" ]; then
109119
return 1 # Don't exclude
110120
fi
@@ -175,7 +185,7 @@ while read -r crate; do
175185
while IFS=$'\x1F' read -r hash subject author date; do
176186
if [ -n "$hash" ]; then
177187
# Check if commit should be excluded
178-
if should_exclude "$subject"; then
188+
if should_exclude "$subject" "$author"; then
179189
log_verbose " Excluding: $subject"
180190
continue
181191
fi

0 commit comments

Comments
 (0)