+43
-16
@@ -250,6 +250,16 @@ class GitCommandManager {
|
|||||||
return output.stdout.trim();
|
return output.stdout.trim();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
initialCommit() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const revListOutput = yield this.execGit([
|
||||||
|
'rev-list',
|
||||||
|
'--max-parents=0',
|
||||||
|
'HEAD'
|
||||||
|
]);
|
||||||
|
return revListOutput.stdout.trim();
|
||||||
|
});
|
||||||
|
}
|
||||||
static createCommandManager(workingDirectory) {
|
static createCommandManager(workingDirectory) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const result = new GitCommandManager();
|
const result = new GitCommandManager();
|
||||||
@@ -812,7 +822,7 @@ class ReleaseNotesBuilder {
|
|||||||
core.startGroup(`🔖 Resolve previous tag`);
|
core.startGroup(`🔖 Resolve previous tag`);
|
||||||
core.debug(`fromTag undefined, trying to resolve via API`);
|
core.debug(`fromTag undefined, trying to resolve via API`);
|
||||||
const tagsApi = new tags_1.Tags(octokit);
|
const tagsApi = new tags_1.Tags(octokit);
|
||||||
const previousTag = yield tagsApi.findPredecessorTag(this.owner, this.repo, this.toTag, this.ignorePreReleases, this.configuration.max_tags_to_fetch ||
|
const previousTag = yield tagsApi.findPredecessorTag(this.repositoryPath, this.owner, this.repo, this.toTag, this.ignorePreReleases, this.configuration.max_tags_to_fetch ||
|
||||||
configuration_1.DefaultConfiguration.max_tags_to_fetch, this.configuration.tag_resolver || configuration_1.DefaultConfiguration.tag_resolver);
|
configuration_1.DefaultConfiguration.max_tags_to_fetch, this.configuration.tag_resolver || configuration_1.DefaultConfiguration.tag_resolver);
|
||||||
if (previousTag == null) {
|
if (previousTag == null) {
|
||||||
utils_1.failOrError(`💥 Unable to retrieve previous tag given ${this.toTag}`, this.failOnError);
|
utils_1.failOrError(`💥 Unable to retrieve previous tag given ${this.toTag}`, this.failOnError);
|
||||||
@@ -888,6 +898,7 @@ exports.sortTags = exports.Tags = void 0;
|
|||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const semver = __importStar(__nccwpck_require__(1383));
|
const semver = __importStar(__nccwpck_require__(1383));
|
||||||
const semver_1 = __nccwpck_require__(1383);
|
const semver_1 = __nccwpck_require__(1383);
|
||||||
|
const gitHelper_1 = __nccwpck_require__(353);
|
||||||
class Tags {
|
class Tags {
|
||||||
constructor(octokit) {
|
constructor(octokit) {
|
||||||
this.octokit = octokit;
|
this.octokit = octokit;
|
||||||
@@ -929,31 +940,38 @@ class Tags {
|
|||||||
return tagsInfo;
|
return tagsInfo;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
findPredecessorTag(owner, repo, tag, ignorePreReleases, maxTagsToFetch, tagResolver) {
|
findPredecessorTag(repositoryPath, owner, repo, tag, ignorePreReleases, maxTagsToFetch, tagResolver) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const tags = sortTags(yield this.getTags(owner, repo, maxTagsToFetch), tagResolver);
|
const tags = sortTags(yield this.getTags(owner, repo, maxTagsToFetch), tagResolver);
|
||||||
try {
|
try {
|
||||||
const length = tags.length;
|
const length = tags.length;
|
||||||
for (let i = 0; i < length; i++) {
|
if (tags.length > 1) {
|
||||||
if (tags[i].name.toLocaleLowerCase() === tag.toLocaleLowerCase()) {
|
for (let i = 0; i < length; i++) {
|
||||||
if (ignorePreReleases) {
|
if (tags[i].name.toLocaleLowerCase() === tag.toLocaleLowerCase()) {
|
||||||
core.info(`ℹ️ Enabled 'ignorePreReleases', searching for the closest release`);
|
if (ignorePreReleases) {
|
||||||
for (let ii = i + 1; ii < length; ii++) {
|
core.info(`ℹ️ Enabled 'ignorePreReleases', searching for the closest release`);
|
||||||
if (!tags[ii].name.includes('-')) {
|
for (let ii = i + 1; ii < length; ii++) {
|
||||||
return tags[ii];
|
if (!tags[ii].name.includes('-')) {
|
||||||
|
return tags[ii];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return tags[i + 1];
|
||||||
}
|
}
|
||||||
return tags[i + 1];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
core.info(`ℹ️ Only one tag found for the given repository. Usually this is the case for the initial release.`);
|
||||||
|
// if not specified try to retrieve tag from git
|
||||||
|
const gitHelper = yield gitHelper_1.createCommandManager(repositoryPath);
|
||||||
|
const initialCommit = yield gitHelper.initialCommit();
|
||||||
|
core.info(`🔖 Resolved initial commit (${initialCommit}) from 'git rev-list --max-parents=0 HEAD'`);
|
||||||
|
return { name: initialCommit, commit: initialCommit };
|
||||||
|
}
|
||||||
return tags[0];
|
return tags[0];
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
if (tags.length < 1) {
|
if (tags.length <= 0) {
|
||||||
core.warning(`⚠️ Only one tag found for the given repository`);
|
|
||||||
}
|
|
||||||
else if (tags.length < 0) {
|
|
||||||
core.warning(`⚠️ No tag found for the given repository`);
|
core.warning(`⚠️ No tag found for the given repository`);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -5179,6 +5197,7 @@ const Endpoints = {
|
|||||||
getSubscriptionPlanForAccountStubbed: ["GET /marketplace_listing/stubbed/accounts/{account_id}"],
|
getSubscriptionPlanForAccountStubbed: ["GET /marketplace_listing/stubbed/accounts/{account_id}"],
|
||||||
getUserInstallation: ["GET /users/{username}/installation"],
|
getUserInstallation: ["GET /users/{username}/installation"],
|
||||||
getWebhookConfigForApp: ["GET /app/hook/config"],
|
getWebhookConfigForApp: ["GET /app/hook/config"],
|
||||||
|
getWebhookDelivery: ["GET /app/hook/deliveries/{delivery_id}"],
|
||||||
listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"],
|
listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"],
|
||||||
listAccountsForPlanStubbed: ["GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"],
|
listAccountsForPlanStubbed: ["GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"],
|
||||||
listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories"],
|
listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories"],
|
||||||
@@ -5189,6 +5208,8 @@ const Endpoints = {
|
|||||||
listReposAccessibleToInstallation: ["GET /installation/repositories"],
|
listReposAccessibleToInstallation: ["GET /installation/repositories"],
|
||||||
listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"],
|
listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"],
|
||||||
listSubscriptionsForAuthenticatedUserStubbed: ["GET /user/marketplace_purchases/stubbed"],
|
listSubscriptionsForAuthenticatedUserStubbed: ["GET /user/marketplace_purchases/stubbed"],
|
||||||
|
listWebhookDeliveries: ["GET /app/hook/deliveries"],
|
||||||
|
redeliverWebhookDelivery: ["POST /app/hook/deliveries/{delivery_id}/attempts"],
|
||||||
removeRepoFromInstallation: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}"],
|
removeRepoFromInstallation: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}"],
|
||||||
resetToken: ["PATCH /applications/{client_id}/token"],
|
resetToken: ["PATCH /applications/{client_id}/token"],
|
||||||
revokeInstallationAccessToken: ["DELETE /installation/token"],
|
revokeInstallationAccessToken: ["DELETE /installation/token"],
|
||||||
@@ -5478,6 +5499,7 @@ const Endpoints = {
|
|||||||
getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"],
|
getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"],
|
||||||
getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"],
|
getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"],
|
||||||
getWebhookConfigForOrg: ["GET /orgs/{org}/hooks/{hook_id}/config"],
|
getWebhookConfigForOrg: ["GET /orgs/{org}/hooks/{hook_id}/config"],
|
||||||
|
getWebhookDelivery: ["GET /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}"],
|
||||||
list: ["GET /organizations"],
|
list: ["GET /organizations"],
|
||||||
listAppInstallations: ["GET /orgs/{org}/installations"],
|
listAppInstallations: ["GET /orgs/{org}/installations"],
|
||||||
listBlockedUsers: ["GET /orgs/{org}/blocks"],
|
listBlockedUsers: ["GET /orgs/{org}/blocks"],
|
||||||
@@ -5490,8 +5512,10 @@ const Endpoints = {
|
|||||||
listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"],
|
listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"],
|
||||||
listPendingInvitations: ["GET /orgs/{org}/invitations"],
|
listPendingInvitations: ["GET /orgs/{org}/invitations"],
|
||||||
listPublicMembers: ["GET /orgs/{org}/public_members"],
|
listPublicMembers: ["GET /orgs/{org}/public_members"],
|
||||||
|
listWebhookDeliveries: ["GET /orgs/{org}/hooks/{hook_id}/deliveries"],
|
||||||
listWebhooks: ["GET /orgs/{org}/hooks"],
|
listWebhooks: ["GET /orgs/{org}/hooks"],
|
||||||
pingWebhook: ["POST /orgs/{org}/hooks/{hook_id}/pings"],
|
pingWebhook: ["POST /orgs/{org}/hooks/{hook_id}/pings"],
|
||||||
|
redeliverWebhookDelivery: ["POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts"],
|
||||||
removeMember: ["DELETE /orgs/{org}/members/{username}"],
|
removeMember: ["DELETE /orgs/{org}/members/{username}"],
|
||||||
removeMembershipForUser: ["DELETE /orgs/{org}/memberships/{username}"],
|
removeMembershipForUser: ["DELETE /orgs/{org}/memberships/{username}"],
|
||||||
removeOutsideCollaborator: ["DELETE /orgs/{org}/outside_collaborators/{username}"],
|
removeOutsideCollaborator: ["DELETE /orgs/{org}/outside_collaborators/{username}"],
|
||||||
@@ -5950,6 +5974,7 @@ const Endpoints = {
|
|||||||
getViews: ["GET /repos/{owner}/{repo}/traffic/views"],
|
getViews: ["GET /repos/{owner}/{repo}/traffic/views"],
|
||||||
getWebhook: ["GET /repos/{owner}/{repo}/hooks/{hook_id}"],
|
getWebhook: ["GET /repos/{owner}/{repo}/hooks/{hook_id}"],
|
||||||
getWebhookConfigForRepo: ["GET /repos/{owner}/{repo}/hooks/{hook_id}/config"],
|
getWebhookConfigForRepo: ["GET /repos/{owner}/{repo}/hooks/{hook_id}/config"],
|
||||||
|
getWebhookDelivery: ["GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}"],
|
||||||
listBranches: ["GET /repos/{owner}/{repo}/branches"],
|
listBranches: ["GET /repos/{owner}/{repo}/branches"],
|
||||||
listBranchesForHeadCommit: ["GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head", {
|
listBranchesForHeadCommit: ["GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head", {
|
||||||
mediaType: {
|
mediaType: {
|
||||||
@@ -5983,9 +6008,11 @@ const Endpoints = {
|
|||||||
listReleases: ["GET /repos/{owner}/{repo}/releases"],
|
listReleases: ["GET /repos/{owner}/{repo}/releases"],
|
||||||
listTags: ["GET /repos/{owner}/{repo}/tags"],
|
listTags: ["GET /repos/{owner}/{repo}/tags"],
|
||||||
listTeams: ["GET /repos/{owner}/{repo}/teams"],
|
listTeams: ["GET /repos/{owner}/{repo}/teams"],
|
||||||
|
listWebhookDeliveries: ["GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries"],
|
||||||
listWebhooks: ["GET /repos/{owner}/{repo}/hooks"],
|
listWebhooks: ["GET /repos/{owner}/{repo}/hooks"],
|
||||||
merge: ["POST /repos/{owner}/{repo}/merges"],
|
merge: ["POST /repos/{owner}/{repo}/merges"],
|
||||||
pingWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/pings"],
|
pingWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/pings"],
|
||||||
|
redeliverWebhookDelivery: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}/attempts"],
|
||||||
removeAppAccessRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps", {}, {
|
removeAppAccessRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps", {}, {
|
||||||
mapToData: "apps"
|
mapToData: "apps"
|
||||||
}],
|
}],
|
||||||
@@ -6142,7 +6169,7 @@ const Endpoints = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const VERSION = "5.3.1";
|
const VERSION = "5.4.1";
|
||||||
|
|
||||||
function endpointsToMethods(octokit, endpointsMap) {
|
function endpointsToMethods(octokit, endpointsMap) {
|
||||||
const newMethods = {};
|
const newMethods = {};
|
||||||
@@ -6527,7 +6554,7 @@ var pluginRequestLog = __nccwpck_require__(8883);
|
|||||||
var pluginPaginateRest = __nccwpck_require__(4193);
|
var pluginPaginateRest = __nccwpck_require__(4193);
|
||||||
var pluginRestEndpointMethods = __nccwpck_require__(3044);
|
var pluginRestEndpointMethods = __nccwpck_require__(3044);
|
||||||
|
|
||||||
const VERSION = "18.6.0";
|
const VERSION = "18.6.7";
|
||||||
|
|
||||||
const Octokit = core.Octokit.plugin(pluginRequestLog.requestLog, pluginRestEndpointMethods.legacyRestEndpointMethods, pluginPaginateRest.paginateRest).defaults({
|
const Octokit = core.Octokit.plugin(pluginRequestLog.requestLog, pluginRestEndpointMethods.legacyRestEndpointMethods, pluginPaginateRest.paginateRest).defaults({
|
||||||
userAgent: `octokit-rest.js/${VERSION}`
|
userAgent: `octokit-rest.js/${VERSION}`
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Generated
+1189
-1033
File diff suppressed because it is too large
Load Diff
+11
-11
@@ -35,25 +35,25 @@
|
|||||||
"@actions/core": "^1.4.0",
|
"@actions/core": "^1.4.0",
|
||||||
"@actions/exec": "^1.1.0",
|
"@actions/exec": "^1.1.0",
|
||||||
"@actions/github": "^5.0.0",
|
"@actions/github": "^5.0.0",
|
||||||
"@octokit/rest": "^18.6.0",
|
"@octokit/rest": "^18.6.7",
|
||||||
"@types/semver": "^7.3.6",
|
"@types/semver": "^7.3.7",
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"semver": "^7.3.5",
|
"semver": "^7.3.5",
|
||||||
"webpack": "^5.40.0"
|
"webpack": "^5.43.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.23",
|
"@types/jest": "^26.0.24",
|
||||||
"@types/node": "^15.12.4",
|
"@types/node": "^16.0.0",
|
||||||
"@typescript-eslint/parser": "^4.28.0",
|
"@typescript-eslint/parser": "^4.28.2",
|
||||||
"@vercel/ncc": "^0.28.6",
|
"@vercel/ncc": "^0.28.6",
|
||||||
"eslint": "^7.29.0",
|
"eslint": "^7.30.0",
|
||||||
"eslint-plugin-github": "^4.1.3",
|
"eslint-plugin-github": "^4.1.3",
|
||||||
"eslint-plugin-jest": "^24.3.6",
|
"eslint-plugin-jest": "^24.3.6",
|
||||||
"jest": "^27.0.5",
|
"jest": "^27.0.6",
|
||||||
"jest-circus": "^27.0.5",
|
"jest-circus": "^27.0.6",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"prettier": "2.3.1",
|
"prettier": "2.3.2",
|
||||||
"ts-jest": "^27.0.3",
|
"ts-jest": "^27.0.3",
|
||||||
"typescript": "^4.3.4"
|
"typescript": "^4.3.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,15 @@ class GitCommandManager {
|
|||||||
return output.stdout.trim()
|
return output.stdout.trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async initialCommit(): Promise<string> {
|
||||||
|
const revListOutput = await this.execGit([
|
||||||
|
'rev-list',
|
||||||
|
'--max-parents=0',
|
||||||
|
'HEAD'
|
||||||
|
])
|
||||||
|
return revListOutput.stdout.trim()
|
||||||
|
}
|
||||||
|
|
||||||
static async createCommandManager(
|
static async createCommandManager(
|
||||||
workingDirectory: string
|
workingDirectory: string
|
||||||
): Promise<GitCommandManager> {
|
): Promise<GitCommandManager> {
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ export class ReleaseNotesBuilder {
|
|||||||
const tagsApi = new Tags(octokit)
|
const tagsApi = new Tags(octokit)
|
||||||
|
|
||||||
const previousTag = await tagsApi.findPredecessorTag(
|
const previousTag = await tagsApi.findPredecessorTag(
|
||||||
|
this.repositoryPath,
|
||||||
this.owner,
|
this.owner,
|
||||||
this.repo,
|
this.repo,
|
||||||
this.toTag,
|
this.toTag,
|
||||||
|
|||||||
+26
-13
@@ -3,6 +3,7 @@ import * as core from '@actions/core'
|
|||||||
import * as semver from 'semver'
|
import * as semver from 'semver'
|
||||||
import {SemVer} from 'semver'
|
import {SemVer} from 'semver'
|
||||||
import {TagResolver} from './configuration'
|
import {TagResolver} from './configuration'
|
||||||
|
import {createCommandManager} from './gitHelper'
|
||||||
|
|
||||||
export interface TagInfo {
|
export interface TagInfo {
|
||||||
name: string
|
name: string
|
||||||
@@ -50,6 +51,7 @@ export class Tags {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async findPredecessorTag(
|
async findPredecessorTag(
|
||||||
|
repositoryPath: string,
|
||||||
owner: string,
|
owner: string,
|
||||||
repo: string,
|
repo: string,
|
||||||
tag: string,
|
tag: string,
|
||||||
@@ -64,26 +66,37 @@ export class Tags {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const length = tags.length
|
const length = tags.length
|
||||||
for (let i = 0; i < length; i++) {
|
if (tags.length > 1) {
|
||||||
if (tags[i].name.toLocaleLowerCase() === tag.toLocaleLowerCase()) {
|
for (let i = 0; i < length; i++) {
|
||||||
if (ignorePreReleases) {
|
if (tags[i].name.toLocaleLowerCase() === tag.toLocaleLowerCase()) {
|
||||||
core.info(
|
if (ignorePreReleases) {
|
||||||
`ℹ️ Enabled 'ignorePreReleases', searching for the closest release`
|
core.info(
|
||||||
)
|
`ℹ️ Enabled 'ignorePreReleases', searching for the closest release`
|
||||||
for (let ii = i + 1; ii < length; ii++) {
|
)
|
||||||
if (!tags[ii].name.includes('-')) {
|
for (let ii = i + 1; ii < length; ii++) {
|
||||||
return tags[ii]
|
if (!tags[ii].name.includes('-')) {
|
||||||
|
return tags[ii]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return tags[i + 1]
|
||||||
}
|
}
|
||||||
return tags[i + 1]
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
core.info(
|
||||||
|
`ℹ️ Only one tag found for the given repository. Usually this is the case for the initial release.`
|
||||||
|
)
|
||||||
|
// if not specified try to retrieve tag from git
|
||||||
|
const gitHelper = await createCommandManager(repositoryPath)
|
||||||
|
const initialCommit = await gitHelper.initialCommit()
|
||||||
|
core.info(
|
||||||
|
`🔖 Resolved initial commit (${initialCommit}) from 'git rev-list --max-parents=0 HEAD'`
|
||||||
|
)
|
||||||
|
return {name: initialCommit, commit: initialCommit}
|
||||||
}
|
}
|
||||||
return tags[0]
|
return tags[0]
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (tags.length < 1) {
|
if (tags.length <= 0) {
|
||||||
core.warning(`⚠️ Only one tag found for the given repository`)
|
|
||||||
} else if (tags.length < 0) {
|
|
||||||
core.warning(`⚠️ No tag found for the given repository`)
|
core.warning(`⚠️ No tag found for the given repository`)
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
|
|||||||
Reference in New Issue
Block a user