httpcat-cli 0.1.1-rc.1 → 0.1.1-rc.2
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,12 +84,66 @@ jobs:
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
// Get commits to analyze
|
|
87
|
+
// Get commits to analyze - only commits in this push/merge
|
|
88
88
|
let compareData;
|
|
89
|
-
|
|
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
|
|
90
146
|
console.log(`Last release tag: ${lastTag}`);
|
|
91
|
-
|
|
92
|
-
// Get commits since last tag
|
|
93
147
|
let baseSha;
|
|
94
148
|
try {
|
|
95
149
|
const { data: tagData } = await github.rest.git.getRef({
|
|
@@ -110,7 +164,6 @@ jobs:
|
|
|
110
164
|
baseSha = null;
|
|
111
165
|
}
|
|
112
166
|
}
|
|
113
|
-
|
|
114
167
|
const response = await github.rest.repos.compareCommits({
|
|
115
168
|
owner: context.repo.owner,
|
|
116
169
|
repo: context.repo.repo,
|
|
@@ -120,7 +173,6 @@ jobs:
|
|
|
120
173
|
compareData = response.data;
|
|
121
174
|
} else {
|
|
122
175
|
console.log('⚠️ No previous tags found, analyzing recent commits...');
|
|
123
|
-
// Get recent commits (last 50) to determine bump type
|
|
124
176
|
const response = await github.rest.repos.listCommits({
|
|
125
177
|
owner: context.repo.owner,
|
|
126
178
|
repo: context.repo.repo,
|