mirror of
https://github.com/joaquinjsb/gitea-release-please-action
synced 2026-05-05 10:37:47 +02:00
committed by
GitHub
parent
c9291a968c
commit
b067e38d2f
44
dist/index.js
vendored
44
dist/index.js
vendored
@@ -56665,6 +56665,7 @@ async function buildStrategy(options) {
|
||||
bumpMinorPreMajor: options.bumpMinorPreMajor,
|
||||
bumpPatchForMinorPreMajor: options.bumpPatchForMinorPreMajor,
|
||||
prereleaseType: options.prereleaseType,
|
||||
prerelease: options.prerelease,
|
||||
});
|
||||
const changelogNotes = (0, changelog_notes_factory_1.buildChangelogNotes)({
|
||||
type: options.changelogType || 'default',
|
||||
@@ -57215,7 +57216,8 @@ class GitHub {
|
||||
}
|
||||
}
|
||||
async mergeCommitsGraphQL(targetBranch, cursor, options = {}) {
|
||||
var _a, _b, _c, _d;
|
||||
var _a, _b, _c, _d, _e, _f, _g;
|
||||
var _h;
|
||||
this.logger.debug(`Fetching merge commits on branch ${targetBranch} with cursor: ${cursor}`);
|
||||
const query = `query pullRequestsSince($owner: String!, $repo: String!, $num: Int!, $maxFilesChanged: Int, $targetBranch: String!, $cursor: String) {
|
||||
repository(owner: $owner, name: $repo) {
|
||||
@@ -57286,17 +57288,38 @@ class GitHub {
|
||||
}
|
||||
const history = response.repository.ref.target.history;
|
||||
const commits = (history.nodes || []);
|
||||
// Count the number of pull requests associated with each merge commit. This is
|
||||
// used in the next step to make sure we only find pull requests with a
|
||||
// merge commit that contain 1 merged commit.
|
||||
const mergeCommitCount = {};
|
||||
for (const commit of commits) {
|
||||
for (const pr of commit.associatedPullRequests.nodes) {
|
||||
if ((_b = pr.mergeCommit) === null || _b === void 0 ? void 0 : _b.oid) {
|
||||
(_c = mergeCommitCount[_h = pr.mergeCommit.oid]) !== null && _c !== void 0 ? _c : (mergeCommitCount[_h] = 0);
|
||||
mergeCommitCount[pr.mergeCommit.oid]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
const commitData = [];
|
||||
for (const graphCommit of commits) {
|
||||
const commit = {
|
||||
sha: graphCommit.sha,
|
||||
message: graphCommit.message,
|
||||
};
|
||||
const pullRequest = graphCommit.associatedPullRequests.nodes.find(pr => {
|
||||
return pr.mergeCommit && pr.mergeCommit.oid === graphCommit.sha;
|
||||
const mergePullRequest = graphCommit.associatedPullRequests.nodes.find(pr => {
|
||||
return (
|
||||
// Only match the pull request with a merge commit if there is a
|
||||
// single merged commit in the PR. This means merge commits and squash
|
||||
// merges will be matched, but rebase merged PRs will only be matched
|
||||
// if they contain a single commit. This is so PRs that are rebased
|
||||
// and merged will have ßSfiles backfilled from each commit instead of
|
||||
// the whole PR.
|
||||
pr.mergeCommit &&
|
||||
pr.mergeCommit.oid === graphCommit.sha &&
|
||||
mergeCommitCount[pr.mergeCommit.oid] === 1);
|
||||
});
|
||||
const pullRequest = mergePullRequest || graphCommit.associatedPullRequests.nodes[0];
|
||||
if (pullRequest) {
|
||||
const files = (((_b = pullRequest.files) === null || _b === void 0 ? void 0 : _b.nodes) || []).map(node => node.path);
|
||||
commit.pullRequest = {
|
||||
sha: commit.sha,
|
||||
number: pullRequest.number,
|
||||
@@ -57305,16 +57328,19 @@ class GitHub {
|
||||
title: pullRequest.title,
|
||||
body: pullRequest.body,
|
||||
labels: pullRequest.labels.nodes.map(node => node.name),
|
||||
files,
|
||||
files: (((_d = pullRequest.files) === null || _d === void 0 ? void 0 : _d.nodes) || []).map(node => node.path),
|
||||
};
|
||||
if (((_d = (_c = pullRequest.files) === null || _c === void 0 ? void 0 : _c.pageInfo) === null || _d === void 0 ? void 0 : _d.hasNextPage) && options.backfillFiles) {
|
||||
this.logger.info(`PR #${pullRequest.number} has many files, backfilling`);
|
||||
}
|
||||
if (mergePullRequest) {
|
||||
if (((_f = (_e = mergePullRequest.files) === null || _e === void 0 ? void 0 : _e.pageInfo) === null || _f === void 0 ? void 0 : _f.hasNextPage) &&
|
||||
options.backfillFiles) {
|
||||
this.logger.info(`PR #${mergePullRequest.number} has many files, backfilling`);
|
||||
commit.files = await this.getCommitFiles(graphCommit.sha);
|
||||
}
|
||||
else {
|
||||
// We cannot directly fetch files on commits via graphql, only provide file
|
||||
// information for commits with associated pull requests
|
||||
commit.files = files;
|
||||
commit.files = (((_g = mergePullRequest.files) === null || _g === void 0 ? void 0 : _g.nodes) || []).map(node => node.path);
|
||||
}
|
||||
}
|
||||
else if (options.backfillFiles) {
|
||||
@@ -116121,7 +116147,7 @@ module.exports = {"i8":"4.3.0"};
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = {"i8":"16.3.0"};
|
||||
module.exports = {"i8":"16.3.1"};
|
||||
|
||||
/***/ }),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user