Skip to content

Commit a7c223f

Browse files
committed
Closes #105: skip MRs in given states
1 parent 7572017 commit a7c223f

4 files changed

Lines changed: 10 additions & 0 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ used to sidestep the problem where pull requests are rejected by GitHub if the f
127127

128128
Filters all merge requests and issues by these labels. The applicable values can be found in the Gitlab API documentation for [issues](https://docs.gitlab.com/ee/api/issues.html#list-project-issues) and [merge requests](https://docs.gitlab.com/ee/api/merge_requests.html#list-merge-requests) respectively. Default is `null` which returns all issues/merge requests.
129129

130+
#### skipMergeRequestStates
131+
132+
Merge requests in GitLab with any of the states listed in this array will not be transferred to GitHub (e.g. set to `['merged', 'closed']` to avoid creating issues for closed MRs whose branches have been deleted).
133+
130134
#### skipMatchingComments
131135

132136
This is an array (empty per default) that may contain string values. Any note/comment in any issue, that contains one or more of those string values, will be skipped (meaining not migrated). Note that this is case insensitive, therefore the string value `foo` would also lead to skipping notes containing a (sub)string `FOO`.

sample_settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export default {
3939
useReplacementIssuesForCreationFails: true,
4040
useIssuesForAllMergeRequests: false,
4141
filterByLabel: null,
42+
skipMergeRequestStates: [],
4243
skipMatchingComments: [],
4344
mergeRequests: {
4445
logFile: './merge-requests.json',

src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ async function transferMergeRequests() {
411411
i => i.title.trim().includes(request.title.trim())
412412
);
413413
if (!githubRequest && !githubIssue) {
414+
if (settings.skipMergeRequestStates.includes(request.state)) {
415+
console.log(`Skipping MR ${request.iid} in "${request.state}" state: ${request.title}`)
416+
continue;
417+
}
414418
console.log(
415419
'Creating pull request: !' + request.iid + ' - ' + request.title
416420
);

src/settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default interface Settings {
2121
useReplacementIssuesForCreationFails: boolean;
2222
useIssuesForAllMergeRequests: boolean;
2323
filterByLabel: string | null;
24+
skipMergeRequestStates: string[];
2425
skipMatchingComments: string[];
2526
mergeRequests: {
2627
logFile: string;

0 commit comments

Comments
 (0)