Skip to content

Commit ae57b04

Browse files
corneliusludmannroboquat
authored andcommitted
[server] Handle releases/tag/<tag> in GitHub context parser
1 parent ef090bb commit ae57b04

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

components/server/src/github/github-context-parser.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,27 @@ class TestGithubContextParser {
283283
)
284284
}
285285

286+
@test public async testReleasesContext_tag_01() {
287+
const result = await this.parser.handle({}, this.user, 'https://github.com/gitpod-io/gitpod/releases/tag/v0.9.0');
288+
expect(result).to.deep.include(
289+
{
290+
"ref": "v0.9.0",
291+
"refType": "tag",
292+
"isFile": false,
293+
"path": "",
294+
"title": "gitpod-io/gitpod - v0.9.0",
295+
"revision": "25ece59c495d525614f28971d41d5708a31bf1e3",
296+
"repository": {
297+
"cloneUrl": "https://github.com/gitpod-io/gitpod.git",
298+
"host": "github.com",
299+
"name": "gitpod",
300+
"owner": "gitpod-io",
301+
"private": false
302+
}
303+
}
304+
)
305+
}
306+
286307
@test public async testCommitsContext_01() {
287308
const result = await this.parser.handle({}, this.user, 'https://github.com/gitpod-io/gitpod-test-repo/commits/4test');
288309
expect(result).to.deep.include({

components/server/src/github/github-context-parser.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ export class GithubContextParser extends AbstractContextParser implements IConte
4040
case 'commits': {
4141
return await this.handleTreeContext({span}, user, host, owner, repoName, moreSegments.slice(1));
4242
}
43+
case 'releases': {
44+
if (moreSegments.length > 1 && moreSegments[1] === "tag") {
45+
return await this.handleTreeContext({ span }, user, host, owner, repoName, moreSegments.slice(2));
46+
}
47+
break;
48+
}
4349
case 'issues': {
4450
const issueNr = parseInt(moreSegments[1], 10);
4551
if (isNaN(issueNr))

0 commit comments

Comments
 (0)