Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d52c639

Browse files
committed
Ignore metadata to test workflow
1 parent ed94e69 commit d52c639

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

.github/workflows/release.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ permissions:
3535

3636
env:
3737
CODER_RELEASE: ${{ github.event.inputs.snapshot && 'false' || 'true' }}
38+
DRY_RUN: ${{ (github.event.inputs.dry_run || github.event.inputs.snapshot) && 'true' || 'false' }}
3839

3940
jobs:
4041
release:
@@ -115,6 +116,11 @@ jobs:
115116
ref=HEAD
116117
old_version="$(git describe --abbrev=0 "$ref^1")"
117118
119+
if [[ $DRY_RUN == true ]]; then
120+
# Allow dry-run of branches to pass.
121+
export CODER_IGNORE_MISSING_COMMIT_METADATA=1
122+
fi
123+
118124
# Cache commit metadata.
119125
. ./scripts/release/check_commit_metadata.sh "$old_version" "$ref"
120126

scripts/release/check_commit_metadata.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ if [[ -z $to_ref ]]; then
2626
error "No to_ref specified"
2727
fi
2828

29+
ignore_missing_metadata=${CODER_IGNORE_MISSING_COMMIT_METADATA:-0}
30+
if [[ $ignore_missing_metadata == 1 ]]; then
31+
log "WARNING: Ignoring missing commit metadata, breaking changes may be missed."
32+
fi
33+
2934
range="$from_ref..$to_ref"
3035

3136
# Check dependencies.
@@ -87,9 +92,11 @@ main() {
8792
commit_sha_long=${parts[1]}
8893
commit_prefix=${parts[2]}
8994

90-
# Safety-check, guarantee all commits had their metadata fetched.
91-
if [[ ! -v labels[$commit_sha_long] ]]; then
92-
error "Metadata missing for commit $commit_sha_short"
95+
if [[ $ignore_missing_metadata != 1 ]]; then
96+
# Safety-check, guarantee all commits had their metadata fetched.
97+
if [[ ! -v labels[$commit_sha_long] ]]; then
98+
error "Metadata missing for commit $commit_sha_short"
99+
fi
93100
fi
94101

95102
# Store the commit title for later use.
@@ -99,11 +106,11 @@ main() {
99106

100107
# First, check the title for breaking changes. This avoids doing a
101108
# GH API request if there's a match.
102-
if [[ $commit_prefix =~ $breaking_title ]] || [[ ${labels[$commit_sha_long]} = *"label:$breaking_label"* ]]; then
109+
if [[ $commit_prefix =~ $breaking_title ]] || [[ ${labels[$commit_sha_long]:-} = *"label:$breaking_label"* ]]; then
103110
COMMIT_METADATA_CATEGORY[$commit_sha_short]=$breaking_category
104111
COMMIT_METADATA_BREAKING=1
105112
continue
106-
elif [[ ${labels[$commit_sha_long]} = *"label:$security_label"* ]]; then
113+
elif [[ ${labels[$commit_sha_long]:-} = *"label:$security_label"* ]]; then
107114
COMMIT_METADATA_CATEGORY[$commit_sha_short]=$security_label
108115
continue
109116
fi

0 commit comments

Comments
 (0)