Skip to content

Commit

Permalink
Merge pull request #4 from wemogy/main
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
SebastianKuesters authored Mar 22, 2024
2 parents 20fa868 + 6c8dd98 commit 2adfd1d
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 13 deletions.
136 changes: 125 additions & 11 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3278,6 +3278,66 @@ paginateRest.VERSION = VERSION;
0 && (0);


/***/ }),

/***/ 8883:
/***/ ((module) => {

"use strict";

var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// pkg/dist-src/index.js
var dist_src_exports = {};
__export(dist_src_exports, {
requestLog: () => requestLog
});
module.exports = __toCommonJS(dist_src_exports);

// pkg/dist-src/version.js
var VERSION = "4.0.1";

// pkg/dist-src/index.js
function requestLog(octokit) {
octokit.hook.wrap("request", (request, options) => {
octokit.log.debug("request", options);
const start = Date.now();
const requestOptions = octokit.request.endpoint.parse(options);
const path = requestOptions.url.replace(options.baseUrl, "");
return request(options).then((response) => {
octokit.log.info(
`${requestOptions.method} ${path} - ${response.status} in ${Date.now() - start}ms`
);
return response;
}).catch((error) => {
octokit.log.info(
`${requestOptions.method} ${path} - ${error.status} in ${Date.now() - start}ms`
);
throw error;
});
});
}
requestLog.VERSION = VERSION;
// Annotate the CommonJS export names for ESM import in node:
0 && (0);


/***/ }),

/***/ 3044:
Expand Down Expand Up @@ -5775,6 +5835,57 @@ var request = withDefaults(import_endpoint.endpoint, {
0 && (0);


/***/ }),

/***/ 5375:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {

"use strict";

var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// pkg/dist-src/index.js
var dist_src_exports = {};
__export(dist_src_exports, {
Octokit: () => Octokit
});
module.exports = __toCommonJS(dist_src_exports);
var import_core = __nccwpck_require__(6762);
var import_plugin_request_log = __nccwpck_require__(8883);
var import_plugin_paginate_rest = __nccwpck_require__(4193);
var import_plugin_rest_endpoint_methods = __nccwpck_require__(3044);

// pkg/dist-src/version.js
var VERSION = "20.0.2";

// pkg/dist-src/index.js
var Octokit = import_core.Octokit.plugin(
import_plugin_request_log.requestLog,
import_plugin_rest_endpoint_methods.legacyRestEndpointMethods,
import_plugin_paginate_rest.paginateRest
).defaults({
userAgent: `octokit-rest.js/${VERSION}`
});
// Annotate the CommonJS export names for ESM import in node:
0 && (0);


/***/ }),

/***/ 3682:
Expand Down Expand Up @@ -29010,6 +29121,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
const rest_1 = __nccwpck_require__(5375);
const ReleaseNotesGenerator_1 = __importDefault(__nccwpck_require__(6686));
const GitHubRepositoryUtils_1 = __importDefault(__nccwpck_require__(7001));
const github = __nccwpck_require__(5438);
Expand All @@ -29028,11 +29140,13 @@ function run() {
// Get context information
const { owner, repo } = github.context.repo;
// construct services
const octokit = github.getOctokit(token);
const octokit = new rest_1.Octokit({
auth: token,
});
const gitHubRepositoryUtils = new GitHubRepositoryUtils_1.default(owner, repo, octokit);
const releaseNotesGenerator = new ReleaseNotesGenerator_1.default();
// Get the referenced issues between the previous release and the current release
const issues = yield gitHubRepositoryUtils.getReferencedIssuesBetweenTags(previousReleaseVersionTag, releaseVersionTag);
const issues = yield gitHubRepositoryUtils.getReferencedIssuesBetweenTags(previousReleaseVersionTag, releaseVersionTag, "release");
// Create the release notes
const releaseNotes = releaseNotesGenerator.generateReleaseNotes(issues);
// Create the release
Expand Down Expand Up @@ -29069,18 +29183,18 @@ class GitHubRepositoryUtils {
this.repo = repo;
this.octokit = octokit;
}
getReferencedIssuesBetweenTags(startTag, endTag) {
return __awaiter(this, void 0, void 0, function* () {
getReferencedIssuesBetweenTags(startTag_1, endTag_1) {
return __awaiter(this, arguments, void 0, function* (startTag, endTag, branch = "main") {
// Get all issues and PRs between start and end tag
const issuesAndPrs = yield this.getReferencedIssuesAndPrsBetweenTags(startTag, endTag);
const issuesAndPrs = yield this.getReferencedIssuesAndPrsBetweenTags(startTag, endTag, branch);
// Flatten issues and PRs
const issues = yield this.mapIssuesAndPrsToIssuesFlat(issuesAndPrs);
return issues;
});
}
getReferencedIssuesAndPrsBetweenTags(startTag, endTag) {
return __awaiter(this, void 0, void 0, function* () {
const commits = yield this.getCommitsBetweenTags(startTag, endTag);
getReferencedIssuesAndPrsBetweenTags(startTag_1, endTag_1) {
return __awaiter(this, arguments, void 0, function* (startTag, endTag, branch = "main") {
const commits = yield this.getCommitsBetweenTags(startTag, endTag, branch);
// Get all referenced issues and PRs from the commit messages
const referencedIssuesAndPrs = commits
.map((commit) => commit.commit.message.match(/#\d+/g))
Expand Down Expand Up @@ -29165,8 +29279,8 @@ class GitHubRepositoryUtils {
}
});
}
getCommitsBetweenTags(startTag, endTag) {
return __awaiter(this, void 0, void 0, function* () {
getCommitsBetweenTags(startTag_1, endTag_1) {
return __awaiter(this, arguments, void 0, function* (startTag, endTag, branch = "main") {
// destructuring
const { owner, repo, octokit } = this;
// Get the commit corresponding to the start tag
Expand All @@ -29179,7 +29293,7 @@ class GitHubRepositoryUtils {
: (yield octokit.repos.listCommits({
owner,
repo,
branch: "main",
branch,
})).data.pop();
// Get all commits between the two SHAs
const compareCommitsWithBaseheadResponse = yield octokit.repos.compareCommitsWithBasehead({
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Octokit } from "@octokit/rest";
import ReleaseNotesGenerator from "./ReleaseNotesGenerator";
import GitHubRepositoryUtils from "./utils/GitHubRepositoryUtils";

Expand All @@ -23,7 +24,9 @@ async function run() {
const { owner, repo } = github.context.repo;

// construct services
const octokit = github.getOctokit(token);
const octokit = new Octokit({
auth: token,
});
const gitHubRepositoryUtils = new GitHubRepositoryUtils(owner, repo, octokit);
const releaseNotesGenerator = new ReleaseNotesGenerator();

Expand Down

0 comments on commit 2adfd1d

Please sign in to comment.