Skip to content

Commit 372833f

Browse files
XS✔ ◾ [Autogenerated] Release v1.6.3 (#540)
Autogenerated release for PR Metrics v1.6.3. This includes the latest dependency updates. This also includes a fix for the previous release where the type definitions were improperly defined, resulting in failures in certain cases. --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent c38e732 commit 372833f

File tree

15 files changed

+69
-18
lines changed

15 files changed

+69
-18
lines changed

.github/workflows/release-phase-1.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
with:
2222
major: 1
2323
minor: 6
24-
patch: 3
24+
patch: 4
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.6.2
1+
1.6.3

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The default input values are expected to be appropriate for most builds.
113113
Therefore, the following YAML definition is recommended:
114114

115115
```YAML
116-
uses: microsoft/PR-Metrics@v1.6.2
116+
uses: microsoft/PR-Metrics@v1.6.3
117117
name: PR Metrics
118118
env:
119119
PR_METRICS_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -123,7 +123,7 @@ continue-on-error: true
123123
If you wish to modify the inputs, YAML akin the to the following can be used:
124124

125125
```YAML
126-
uses: microsoft/PR-Metrics@v1.6.2
126+
uses: microsoft/PR-Metrics@v1.6.3
127127
name: PR Metrics
128128
env:
129129
PR_METRICS_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/resources.resjson

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://json.schemastore.org/resjson.json",
33
"loc.description": "Augments pull request titles to let reviewers quickly determine PR size and test coverage.",
44
"loc.description.comment": "The description of the task.",
5-
"loc.friendlyName": "PR Metrics v1.6.2",
5+
"loc.friendlyName": "PR Metrics v1.6.3",
66
"loc.friendlyName.comment": "The name of the task.",
77
"loc.helpMarkDown": "[More information](https://aka.ms/PRMetrics/README)",
88
"loc.helpMarkDown.comment": "The Markdown-formatted help text of the task.",

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://json.schemastore.org/package.json",
33
"name": "prmetrics",
44
"publisher": "ms-omex",
5-
"version": "1.6.2",
5+
"version": "1.6.3",
66
"description": "Augments pull request titles to let reviewers quickly determine PR size and test coverage.",
77
"main": "dist/index.js",
88
"scripts": {

src/task/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://json.schemastore.org/resjson.json",
33
"loc.description": "Augments pull request titles to let reviewers quickly determine PR size and test coverage.",
44
"loc.description.comment": "The description of the task.",
5-
"loc.friendlyName": "PR Metrics v1.6.2",
5+
"loc.friendlyName": "PR Metrics v1.6.3",
66
"loc.friendlyName.comment": "The name of the task.",
77
"loc.helpMarkDown": "[More information](https://aka.ms/PRMetrics/README)",
88
"loc.helpMarkDown.comment": "The Markdown-formatted help text of the task.",

src/task/src/repos/azureReposInvoker.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ export default class AzureReposInvoker extends BaseReposInvoker {
9292
const status: CommentThreadStatus =
9393
value.status ?? CommentThreadStatus.Unknown;
9494

95-
if (typeof value.threadContext === "undefined") {
95+
if (
96+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- The type definition is incorrect.
97+
value.threadContext === null ||
98+
typeof value.threadContext === "undefined"
99+
) {
96100
result.pullRequestComments.push(
97101
new PullRequestCommentData(id, content, status),
98102
);

src/task/src/repos/gitHubReposInvoker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ export default class GitHubReposInvoker extends BaseReposInvoker {
288288
this._logger.logWarning(`Octokit – ${message}`);
289289
},
290290
},
291-
userAgent: "PRMetrics/v1.6.2",
291+
userAgent: "PRMetrics/v1.6.3",
292292
};
293293

294294
if (RunnerInvoker.isGitHub) {

src/task/task.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://raw.githubusercontent.com/microsoft/azure-pipelines-task-lib/master/tasks.schema.json",
33
"id": "907d3b28-6b37-4ac7-ac75-9631ee53e512",
44
"name": "PRMetrics",
5-
"friendlyName": "PR Metrics v1.6.2",
5+
"friendlyName": "PR Metrics v1.6.3",
66
"description": "Augments pull request titles to let reviewers quickly determine PR size and test coverage.",
77
"helpUrl": "https://aka.ms/PRMetrics/README",
88
"helpMarkDown": "[More information](https://aka.ms/PRMetrics/README)",
@@ -13,7 +13,7 @@
1313
"version": {
1414
"Major": 1,
1515
"Minor": 6,
16-
"Patch": 2
16+
"Patch": 3
1717
},
1818
"instanceNameFormat": "PR Metrics",
1919
"showEnvironmentVariables": true,

src/task/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"version": {
1414
"Major": 1,
1515
"Minor": 6,
16-
"Patch": 2
16+
"Patch": 3
1717
},
1818
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
1919
"showEnvironmentVariables": true,

src/task/tests/repos/azureReposInvoker.spec.ts

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ describe("azureReposInvoker.ts", (): void => {
558558
});
559559
}
560560

561-
it("should return the result when called with a pull request comment", async (): Promise<void> => {
561+
it("should return the result when called with a pull request comment whose thread context is undefined", async (): Promise<void> => {
562562
// Arrange
563563
when(gitApi.getThreads("RepoID", 10, "Project")).thenResolve([
564564
{ comments: [{ content: "Content" }], id: 1, status: 1 },
@@ -600,6 +600,53 @@ describe("azureReposInvoker.ts", (): void => {
600600
).once();
601601
});
602602

603+
it("should return the result when called with a pull request comment whose thread context is null", async (): Promise<void> => {
604+
// Arrange
605+
when(gitApi.getThreads("RepoID", 10, "Project")).thenResolve([
606+
{
607+
comments: [{ content: "Content" }],
608+
id: 1,
609+
status: 1,
610+
threadContext: null as unknown as undefined,
611+
},
612+
]);
613+
const azureReposInvoker: AzureReposInvoker = new AzureReposInvoker(
614+
instance(azureDevOpsApiWrapper),
615+
instance(gitInvoker),
616+
instance(logger),
617+
instance(runnerInvoker),
618+
instance(tokenManager),
619+
);
620+
621+
// Act
622+
const result: CommentData = await azureReposInvoker.getComments();
623+
624+
// Assert
625+
assert.equal(result.pullRequestComments.length, 1);
626+
assert.equal(result.pullRequestComments[0]?.id, 1);
627+
assert.equal(result.pullRequestComments[0]?.content, "Content");
628+
assert.equal(
629+
result.pullRequestComments[0]?.status,
630+
CommentThreadStatus.Active,
631+
);
632+
assert.equal(result.fileComments.length, 0);
633+
verify(azureDevOpsApiWrapper.getPersonalAccessTokenHandler("PAT")).once();
634+
verify(
635+
azureDevOpsApiWrapper.getWebApiInstance(
636+
"https://dev.azure.com/organization",
637+
any(),
638+
),
639+
).once();
640+
verify(gitApi.getThreads("RepoID", 10, "Project")).once();
641+
verify(logger.logDebug("* AzureReposInvoker.getComments()")).once();
642+
verify(logger.logDebug("* AzureReposInvoker.getGitApi()")).once();
643+
verify(
644+
logger.logDebug(
645+
'[{"comments":[{"content":"Content"}],"id":1,"status":1,"threadContext":null}]',
646+
),
647+
).once();
648+
});
649+
603650
it("should return the result when called with a file comment", async (): Promise<void> => {
604651
// Arrange
605652
when(gitApi.getThreads("RepoID", 10, "Project")).thenResolve([

src/task/tests/repos/gitHubReposInvoker.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe("gitHubReposInvoker.ts", (): void => {
3434
let octokitWrapper: OctokitWrapper;
3535
let runnerInvoker: RunnerInvoker;
3636

37-
const expectedUserAgent = "PRMetrics/v1.6.2";
37+
const expectedUserAgent = "PRMetrics/v1.6.3";
3838

3939
beforeEach((): void => {
4040
process.env.PR_METRICS_ACCESS_TOKEN = "PAT";

src/vss-extension.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"manifestVersion": 1,
44
"id": "PRMetrics",
55
"name": "PR Metrics",
6-
"version": "1.6.2",
6+
"version": "1.6.3",
77
"publisher": "ms-omex",
88
"description": "Augments pull request titles to let reviewers quickly determine PR size and test coverage.",
99
"public": true,

0 commit comments

Comments
 (0)