Skip to content

Commit 0cdbefd

Browse files
Merge pull request #285 from technote-space/release/next-v3.0.2
release: v3.0.3
2 parents c3a32d9 + f650ad5 commit 0cdbefd

File tree

4 files changed

+15
-23
lines changed

4 files changed

+15
-23
lines changed

__tests__/api-helper1.test.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ const createCommitResponse: GitCreateCommitResponseData = {
5959
verified: true,
6060
},
6161
};
62-
const escape = value => encodeURIComponent(value).replace(new RegExp('%2F', 'g'), '%252F');
6362

6463
describe('ApiHelper', () => {
6564
disableNetConnect(nock);
@@ -213,7 +212,7 @@ describe('ApiHelper', () => {
213212
const fn1 = jest.fn();
214213
const fn2 = jest.fn();
215214
nock('https://api.github.com')
216-
.patch('/repos/hello/world/git/refs/' + escape('heads/test'), body => {
215+
.patch(`/repos/hello/world/git/refs/${encodeURIComponent('heads/test')}`, body => {
217216
fn1();
218217
expect(body).toHaveProperty('sha');
219218
return body;
@@ -223,7 +222,7 @@ describe('ApiHelper', () => {
223222
return getApiFixture(rootDir, 'repos.git.refs.update');
224223
});
225224

226-
await helper.updateRef(createCommitResponse, await helper.getRefForUpdate(true), false);
225+
await helper.updateRef(createCommitResponse, await helper.getRefForUpdate(false), false);
227226

228227
expect(fn1).toBeCalledTimes(1);
229228
expect(fn2).toBeCalledTimes(1);
@@ -234,7 +233,7 @@ describe('ApiHelper', () => {
234233
const fn2 = jest.fn();
235234
const fn3 = jest.fn();
236235
nock('https://api.github.com')
237-
.patch('/repos/hello/world/git/refs/' + escape('heads/new-topic'), body => {
236+
.patch(`/repos/hello/world/git/refs/${encodeURIComponent('heads/new-topic')}`, body => {
238237
fn1();
239238
expect(body).toHaveProperty('sha');
240239
return body;
@@ -253,7 +252,7 @@ describe('ApiHelper', () => {
253252
ref: 'refs/pull/123/merge',
254253
});
255254
const helper = new ApiHelper(octokit, _context, logger);
256-
await helper.updateRef(createCommitResponse, await helper.getRefForUpdate(true), false);
255+
await helper.updateRef(createCommitResponse, await helper.getRefForUpdate(false), false);
257256

258257
expect(fn1).toBeCalledTimes(1);
259258
expect(fn2).toBeCalledTimes(1);
@@ -263,7 +262,7 @@ describe('ApiHelper', () => {
263262
it('should cache PR get api', async() => {
264263
const fn = jest.fn();
265264
nock('https://api.github.com')
266-
.patch('/repos/hello/world/git/refs/' + escape('heads/new-topic'))
265+
.patch(`/repos/hello/world/git/refs/${encodeURIComponent('heads/new-topic')}`)
267266
.reply(200, () => {
268267
return getApiFixture(rootDir, 'repos.git.refs.update');
269268
})
@@ -279,22 +278,22 @@ describe('ApiHelper', () => {
279278
const helper = new ApiHelper(octokit, _context, logger);
280279
await helper.getRefForUpdate(true);
281280
await helper.getRefForUpdate(true);
282-
await helper.updateRef(createCommitResponse, await helper.getRefForUpdate(true), false);
281+
await helper.updateRef(createCommitResponse, await helper.getRefForUpdate(false), false);
283282

284283
expect(fn).toBeCalledTimes(1);
285284
});
286285

287286
it('should output warning', async() => {
288287
nock('https://api.github.com')
289-
.patch('/repos/hello/world/git/refs/' + escape('heads/test'), body => {
288+
.patch(`/repos/hello/world/git/refs/${encodeURIComponent('heads/test')}`, body => {
290289
expect(body).toHaveProperty('sha');
291290
return body;
292291
})
293292
.reply(403, {
294293
'message': 'Required status check "Test" is expected.',
295294
});
296295

297-
await expect(helper.updateRef(createCommitResponse, await helper.getRefForUpdate(true), false)).rejects.toThrow('Required status check "Test" is expected.');
296+
await expect(helper.updateRef(createCommitResponse, await helper.getRefForUpdate(false), false)).rejects.toThrow('Required status check "Test" is expected.');
298297
});
299298
});
300299

@@ -579,7 +578,7 @@ describe('ApiHelper', () => {
579578
.reply(201, () => getApiFixture(rootDir, 'repos.git.trees'))
580579
.post('/repos/hello/world/git/commits')
581580
.reply(201, () => getApiFixture(rootDir, 'repos.git.commits'))
582-
.patch('/repos/hello/world/git/refs/' + escape('heads/test'))
581+
.patch(`/repos/hello/world/git/refs/${encodeURIComponent('heads/test')}`)
583582
.reply(200, () => getApiFixture(rootDir, 'repos.git.refs.update'));
584583

585584
expect(await helper.commit(rootDir, 'test commit message', ['build1.json', 'build2.json'])).toBe(true);
@@ -590,7 +589,7 @@ describe('ApiHelper', () => {
590589
'::endgroup::',
591590
'::group::Creating commit... [cd8274d15fa3ae2ab983129fb037999f264ba9a7]',
592591
'::endgroup::',
593-
'::group::Updating ref... [heads%252Ftest] [7638417db6d59f3c431d3e1f261cc637155684cd]',
592+
'::group::Updating ref... [heads/test] [7638417db6d59f3c431d3e1f261cc637155684cd]',
594593
'::set-env name=GITHUB_SHA::7638417db6d59f3c431d3e1f261cc637155684cd',
595594
'::endgroup::',
596595
]);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@technote-space/github-action-helper",
3-
"version": "3.0.2",
3+
"version": "3.0.3",
44
"description": "Helper to filter GitHub Action.",
55
"author": {
66
"name": "Technote",

src/api-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ export default class ApiHelper {
444444
}
445445

446446
const commit = await this.prepareCommit(rootDir, commitMessage, files);
447-
const ref = await this.getRefForUpdate(true);
447+
const ref = await this.getRefForUpdate(false);
448448

449449
this.callLogger(logger => logger.startProcess('Updating ref... [%s] [%s]', ref, commit.sha));
450450
if (await this.updateRef(commit, ref, false)) {

yarn.lock

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2545,11 +2545,9 @@ is-plain-object@^2.0.3, is-plain-object@^2.0.4:
25452545
isobject "^3.0.1"
25462546

25472547
is-plain-object@^3.0.0:
2548-
version "3.0.0"
2549-
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-3.0.0.tgz#47bfc5da1b5d50d64110806c199359482e75a928"
2550-
integrity sha512-tZIpofR+P05k8Aocp7UI/2UTa9lTJSebCXpFFoR9aibpokDj/uXBsJ8luUu0tTVYKkMU6URDUuOfJZ7koewXvg==
2551-
dependencies:
2552-
isobject "^4.0.0"
2548+
version "3.0.1"
2549+
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-3.0.1.tgz#662d92d24c0aa4302407b0d45d21f2251c85f85b"
2550+
integrity sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g==
25532551

25542552
is-potential-custom-element-name@^1.0.0:
25552553
version "1.0.0"
@@ -2617,11 +2615,6 @@ isobject@^3.0.0, isobject@^3.0.1:
26172615
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
26182616
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=
26192617

2620-
isobject@^4.0.0:
2621-
version "4.0.0"
2622-
resolved "https://registry.yarnpkg.com/isobject/-/isobject-4.0.0.tgz#3f1c9155e73b192022a80819bacd0343711697b0"
2623-
integrity sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA==
2624-
26252618
isstream@~0.1.2:
26262619
version "0.1.2"
26272620
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"

0 commit comments

Comments
 (0)