httpcat-cli 0.1.1-rc.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -84,66 +84,12 @@ jobs:
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
// Get commits to analyze
|
|
87
|
+
// Get commits to analyze
|
|
88
88
|
let compareData;
|
|
89
|
-
|
|
90
|
-
// For push events, get commits between the previous commit and current HEAD
|
|
91
|
-
// This ensures we only analyze commits in the current merge/push, not all commits since last release
|
|
92
|
-
if (context.eventName === 'push' && context.payload.before) {
|
|
93
|
-
console.log(`Analyzing commits in this push (${context.payload.before}..${context.sha})...`);
|
|
94
|
-
try {
|
|
95
|
-
const response = await github.rest.repos.compareCommits({
|
|
96
|
-
owner: context.repo.owner,
|
|
97
|
-
repo: context.repo.repo,
|
|
98
|
-
base: context.payload.before,
|
|
99
|
-
head: context.sha
|
|
100
|
-
});
|
|
101
|
-
compareData = response.data;
|
|
102
|
-
console.log(`Found ${compareData.commits.length} commits in this push`);
|
|
103
|
-
} catch (e) {
|
|
104
|
-
console.log(`Could not compare commits, falling back to last release: ${e.message}`);
|
|
105
|
-
// Fallback to comparing with last release tag
|
|
106
|
-
if (lastTag) {
|
|
107
|
-
let baseSha;
|
|
108
|
-
try {
|
|
109
|
-
const { data: tagData } = await github.rest.git.getRef({
|
|
110
|
-
owner: context.repo.owner,
|
|
111
|
-
repo: context.repo.repo,
|
|
112
|
-
ref: `tags/${lastTag}`
|
|
113
|
-
});
|
|
114
|
-
baseSha = tagData.object.sha;
|
|
115
|
-
} catch (e2) {
|
|
116
|
-
try {
|
|
117
|
-
const { data: commitData } = await github.rest.repos.getCommit({
|
|
118
|
-
owner: context.repo.owner,
|
|
119
|
-
repo: context.repo.repo,
|
|
120
|
-
ref: lastTag
|
|
121
|
-
});
|
|
122
|
-
baseSha = commitData.sha;
|
|
123
|
-
} catch (e3) {
|
|
124
|
-
baseSha = null;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
const response = await github.rest.repos.compareCommits({
|
|
128
|
-
owner: context.repo.owner,
|
|
129
|
-
repo: context.repo.repo,
|
|
130
|
-
base: baseSha || 'main',
|
|
131
|
-
head: context.sha
|
|
132
|
-
});
|
|
133
|
-
compareData = response.data;
|
|
134
|
-
} else {
|
|
135
|
-
// Last resort: get recent commits
|
|
136
|
-
const response = await github.rest.repos.listCommits({
|
|
137
|
-
owner: context.repo.owner,
|
|
138
|
-
repo: context.repo.repo,
|
|
139
|
-
per_page: 50
|
|
140
|
-
});
|
|
141
|
-
compareData = { commits: response.data };
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
} else if (lastTag) {
|
|
145
|
-
// For other events (like workflow_dispatch), compare with last release
|
|
89
|
+
if (lastTag) {
|
|
146
90
|
console.log(`Last release tag: ${lastTag}`);
|
|
91
|
+
|
|
92
|
+
// Get commits since last tag
|
|
147
93
|
let baseSha;
|
|
148
94
|
try {
|
|
149
95
|
const { data: tagData } = await github.rest.git.getRef({
|
|
@@ -164,6 +110,7 @@ jobs:
|
|
|
164
110
|
baseSha = null;
|
|
165
111
|
}
|
|
166
112
|
}
|
|
113
|
+
|
|
167
114
|
const response = await github.rest.repos.compareCommits({
|
|
168
115
|
owner: context.repo.owner,
|
|
169
116
|
repo: context.repo.repo,
|
|
@@ -173,6 +120,7 @@ jobs:
|
|
|
173
120
|
compareData = response.data;
|
|
174
121
|
} else {
|
|
175
122
|
console.log('⚠️ No previous tags found, analyzing recent commits...');
|
|
123
|
+
// Get recent commits (last 50) to determine bump type
|
|
176
124
|
const response = await github.rest.repos.listCommits({
|
|
177
125
|
owner: context.repo.owner,
|
|
178
126
|
repo: context.repo.repo,
|