Skip to content

Commit dc8866c

Browse files
committed
Fallback to the base ref if the previous tag cannot be found
The previous tag may not exist on new projects, so just list the new commits compared to the base ref. Change-type: patch Signed-off-by: Kyle Harding <[email protected]>
1 parent 19f1243 commit dc8866c

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

.github/workflows/flowzone.yml

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flowzone.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,17 +1509,18 @@ jobs:
15091509
15101510
// Get the previous version tag
15111511
const previousTag = filteredTags.find(tag => tag.name.match(/^v\d+\.\d+\.\d+/));
1512+
const head = context.payload.pull_request?.head.sha || context.sha;
1513+
let base;
15121514
15131515
if (!previousTag) {
1514-
core.setFailed('No previous version tag found');
1516+
const baseRef = context.payload.pull_request?.base.ref;
1517+
core.warning(`No previous version tag found, using ${baseRef}`);
1518+
base = baseRef;
1519+
} else {
1520+
core.info(`Found previous versioned tag: ${previousTag.name}`);
1521+
base = previousTag.name;
15151522
}
15161523
1517-
console.log('previousTag:', JSON.stringify(previousTag, null, 2));
1518-
core.setOutput('previousTag', previousTag);
1519-
1520-
const base = previousTag.name;
1521-
const head = context.payload.pull_request?.head.sha || context.sha;
1522-
15231524
// Get commit history between previous tag and current commit
15241525
const { data: { commits } } = await github.rest.repos.compareCommitsWithBasehead({
15251526
...context.repo,

0 commit comments

Comments
 (0)