Skip to content

Commit f2194bd

Browse files
authored
fix: revert "feat: comment on issues and merge requests resolved by current release" (#335)
1 parent 4d0853b commit f2194bd

File tree

9 files changed

+17
-321
lines changed

9 files changed

+17
-321
lines changed

README.md

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# @semantic-release/gitlab
2-
# @semantic-release/gitlab
32

43
[**semantic-release**](https://github.com/semantic-release/semantic-release) plugin to publish a
54
[GitLab release](https://docs.gitlab.com/ee/user/project/releases/).
@@ -11,7 +10,6 @@
1110
|--------------------|-----------------------------------------------------------------------------------------------------------------------|
1211
| `verifyConditions` | Verify the presence and the validity of the authentication (set via [environment variables](#environment-variables)). |
1312
| `publish` | Publish a [GitLab release](https://docs.gitlab.com/ee/user/project/releases/). |
14-
| `success` | Add a comment to each GitLab Issue or Merge Request resolved by the release. |
1513

1614
## Install
1715

@@ -60,13 +58,12 @@ Create a [personal access token](https://docs.gitlab.com/ce/user/profile/persona
6058

6159
### Options
6260

63-
| Option | Description | Default |
64-
|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
65-
| `gitlabUrl` | The GitLab endpoint. | `GL_URL` or `GITLAB_URL` environment variable or CI provided environment variables if running on [GitLab CI/CD](https://docs.gitlab.com/ee/ci) or `https://gitlab.com`. |
66-
| `gitlabApiPathPrefix` | The GitLab API prefix. | `GL_PREFIX` or `GITLAB_PREFIX` environment variable or CI provided environment variables if running on [GitLab CI/CD](https://docs.gitlab.com/ee/ci) or `/api/v4`. |
67-
| `assets` | An array of files to upload to the release. See [assets](#assets). | - |
68-
| `milestones` | An array of milestone titles to associate to the release. See [GitLab Release API](https://docs.gitlab.com/ee/api/releases/#create-a-release). | - |
69-
| `successComment` | The comment to add to each Issue and Merge Request resolved by the release. Set to false to disable commenting. See [successComment](#successComment). | :tada: This issue has been resolved in version ${nextRelease.version} :tada:\n\nThe release is available on [GitLab release](<gitlab_release_url>) |
61+
| Option | Description | Default |
62+
|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
63+
| `gitlabUrl` | The GitLab endpoint. | `GL_URL` or `GITLAB_URL` environment variable or CI provided environment variables if running on [GitLab CI/CD](https://docs.gitlab.com/ee/ci) or `https://gitlab.com`. |
64+
| `gitlabApiPathPrefix` | The GitLab API prefix. | `GL_PREFIX` or `GITLAB_PREFIX` environment variable or CI provided environment variables if running on [GitLab CI/CD](https://docs.gitlab.com/ee/ci) or `/api/v4`. |
65+
| `assets` | An array of files to upload to the release. See [assets](#assets). | - |
66+
| `milestones` | An array of milestone titles to associate to the release. See [GitLab Release API](https://docs.gitlab.com/ee/api/releases/#create-a-release). | - |
7067

7168
#### assets
7269

@@ -103,20 +100,6 @@ distribution` and `MyLibrary CSS distribution` in the GitLab release.
103100
`css` files in the `dist` directory and its sub-directories excluding the minified version, plus the
104101
`build/MyLibrary.zip` file and label it `MyLibrary` in the GitLab release.
105102

106-
#### successComment
107-
108-
The message for the issue comments is generated with [Lodash template](https://lodash.com/docs#template). The following variables are available:
109-
110-
| Parameter | Description |
111-
|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
112-
| `branch` | `Object` with `name`, `type`, `channel`, `range` and `prerelease` properties of the branch from which the release is done. |
113-
| `lastRelease` | `Object` with `version`, `channel`, `gitTag` and `gitHead` of the last release. |
114-
| `nextRelease` | `Object` with `version`, `channel`, `gitTag`, `gitHead` and `notes` of the release being done. |
115-
| `commits` | `Array` of commit `Object`s with `hash`, `subject`, `body` `message` and `author`. |
116-
| `releases` | `Array` with a release `Object`s for each release published, with optional release data such as `name` and `url`. |
117-
| `mergeRequest` | A [GitLab API Issue object](https://docs.gitlab.com/ee/api/issues.html#single-issue) the comment will be posted to, or `false` when commenting Merge Requests.
118-
| `issue` | A [GitHub API Merge Request object](https://docs.gitlab.com/ee/api/merge_requests.html#get-single-mr) the comment will be posted to, or `false` when commenting Issues.
119-
120103
## Compatibility
121104

122105
The latest version of this plugin is compatible with all currently-supported versions of GitLab, [which is the current major version and previous two major versions](https://about.gitlab.com/support/statement-of-support.html#version-support). This plugin is not guaranteed to work with unsupported versions of GitLab.

index.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
const verifyGitLab = require('./lib/verify');
44
const publishGitLab = require('./lib/publish');
5-
const successGitLab = require('./lib/success');
65

76
let verified;
87

@@ -20,13 +19,4 @@ async function publish(pluginConfig, context) {
2019
return publishGitLab(pluginConfig, context);
2120
}
2221

23-
async function success(pluginConfig, context) {
24-
if (!verified) {
25-
await verifyGitLab(pluginConfig, context);
26-
verified = true;
27-
}
28-
29-
return successGitLab(pluginConfig, context);
30-
}
31-
32-
module.exports = {verifyConditions, publish, success};
22+
module.exports = {verifyConditions, publish};

lib/definitions/constants.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

lib/get-success-comment.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

lib/publish.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const debug = require('debug')('semantic-release:gitlab');
99
const resolveConfig = require('./resolve-config');
1010
const getRepoId = require('./get-repo-id');
1111
const getAssets = require('./glob-assets');
12-
const {RELEASE_NAME} = require('./definitions/constants');
1312

1413
module.exports = async (pluginConfig, context) => {
1514
const {
@@ -118,7 +117,5 @@ module.exports = async (pluginConfig, context) => {
118117

119118
logger.log('Published GitLab release: %s', gitTag);
120119

121-
const releaseUrl = urlJoin(gitlabUrl, encodedRepoId, `/-/releases/${encodedGitTag}`);
122-
123-
return {name: RELEASE_NAME, url: releaseUrl};
120+
return {url: urlJoin(gitlabUrl, encodedRepoId, `/-/releases/${encodedGitTag}`), name: 'GitLab release'};
124121
};

lib/resolve-config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const {castArray, isNil} = require('lodash');
22
const urlJoin = require('url-join');
33

44
module.exports = (
5-
{gitlabUrl, gitlabApiPathPrefix, assets, milestones, successComment},
5+
{gitlabUrl, gitlabApiPathPrefix, assets, milestones},
66
{
77
envCi: {service} = {},
88
env: {
@@ -29,6 +29,7 @@ module.exports = (
2929
(service === 'gitlab' && CI_PROJECT_URL && CI_PROJECT_PATH
3030
? CI_PROJECT_URL.replace(new RegExp(`/${CI_PROJECT_PATH}$`), '')
3131
: 'https://gitlab.com');
32+
3233
return {
3334
gitlabToken: GL_TOKEN || GITLAB_TOKEN,
3435
gitlabUrl: defaultedGitlabUrl,
@@ -40,6 +41,5 @@ module.exports = (
4041
: urlJoin(defaultedGitlabUrl, isNil(userGitlabApiPathPrefix) ? '/api/v4' : userGitlabApiPathPrefix),
4142
assets: assets ? castArray(assets) : assets,
4243
milestones: milestones ? castArray(milestones) : milestones,
43-
successComment,
4444
};
4545
};

lib/success.js

Lines changed: 0 additions & 96 deletions
This file was deleted.

test/resolve-config.test.js

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,14 @@ test('Returns user config', t => {
77
const gitlabUrl = 'https://host.com';
88
const gitlabApiPathPrefix = '/api/prefix';
99
const assets = ['file.js'];
10-
const postComments = true;
1110

12-
t.deepEqual(
13-
resolveConfig({gitlabUrl, gitlabApiPathPrefix, assets, postComments}, {env: {GITLAB_TOKEN: gitlabToken}}),
14-
{
15-
gitlabToken,
16-
gitlabUrl,
17-
gitlabApiUrl: urlJoin(gitlabUrl, gitlabApiPathPrefix),
18-
assets,
19-
milestones: undefined,
20-
successComment: undefined,
21-
}
22-
);
11+
t.deepEqual(resolveConfig({gitlabUrl, gitlabApiPathPrefix, assets}, {env: {GITLAB_TOKEN: gitlabToken}}), {
12+
gitlabToken,
13+
gitlabUrl,
14+
gitlabApiUrl: urlJoin(gitlabUrl, gitlabApiPathPrefix),
15+
assets,
16+
milestones: undefined,
17+
});
2318
});
2419

2520
test('Returns user config via environment variables', t => {
@@ -40,7 +35,6 @@ test('Returns user config via environment variables', t => {
4035
gitlabApiUrl: urlJoin(gitlabUrl, gitlabApiPathPrefix),
4136
assets,
4237
milestones,
43-
successComment: undefined,
4438
}
4539
);
4640
});
@@ -59,7 +53,6 @@ test('Returns user config via alternative environment variables', t => {
5953
gitlabApiUrl: urlJoin(gitlabUrl, gitlabApiPathPrefix),
6054
assets,
6155
milestones: undefined,
62-
successComment: undefined,
6356
}
6457
);
6558
});
@@ -75,7 +68,6 @@ test('Returns default config', t => {
7568
gitlabApiUrl: urlJoin('https://gitlab.com', '/api/v4'),
7669
assets: undefined,
7770
milestones: undefined,
78-
successComment: undefined,
7971
});
8072

8173
t.deepEqual(resolveConfig({gitlabApiPathPrefix}, {env: {GL_TOKEN: gitlabToken}}), {
@@ -84,7 +76,6 @@ test('Returns default config', t => {
8476
gitlabApiUrl: urlJoin('https://gitlab.com', gitlabApiPathPrefix),
8577
assets: undefined,
8678
milestones: undefined,
87-
successComment: undefined,
8879
});
8980

9081
t.deepEqual(resolveConfig({gitlabUrl}, {env: {GL_TOKEN: gitlabToken}}), {
@@ -93,7 +84,6 @@ test('Returns default config', t => {
9384
gitlabApiUrl: urlJoin(gitlabUrl, '/api/v4'),
9485
assets: undefined,
9586
milestones: undefined,
96-
successComment: undefined,
9787
});
9888
});
9989

@@ -117,7 +107,6 @@ test('Returns default config via GitLab CI/CD environment variables', t => {
117107
gitlabApiUrl: CI_API_V4_URL,
118108
assets: undefined,
119109
milestones: undefined,
120-
successComment: undefined,
121110
}
122111
);
123112
});
@@ -145,7 +134,6 @@ test('Returns user config over GitLab CI/CD environment variables', t => {
145134
gitlabApiUrl: urlJoin(gitlabUrl, gitlabApiPathPrefix),
146135
assets,
147136
milestones: undefined,
148-
successComment: undefined,
149137
}
150138
);
151139
});
@@ -179,7 +167,6 @@ test('Returns user config via environment variables over GitLab CI/CD environmen
179167
gitlabApiUrl: urlJoin(gitlabUrl, gitlabApiPathPrefix),
180168
assets: undefined,
181169
milestones: undefined,
182-
successComment: undefined,
183170
}
184171
);
185172
});
@@ -213,7 +200,6 @@ test('Returns user config via alternative environment variables over GitLab CI/C
213200
gitlabApiUrl: urlJoin(gitlabUrl, gitlabApiPathPrefix),
214201
assets: undefined,
215202
milestones: undefined,
216-
successComment: undefined,
217203
}
218204
);
219205
});
@@ -238,7 +224,6 @@ test('Ignore GitLab CI/CD environment variables if not running on GitLab CI/CD',
238224
gitlabApiUrl: urlJoin('https://gitlab.com', '/api/v4'),
239225
assets: undefined,
240226
milestones: undefined,
241-
successComment: undefined,
242227
}
243228
);
244229
});

0 commit comments

Comments
 (0)