Skip to content

Commit 8d96292

Browse files
authored
Prepare for v1.3.0 (#1038)
2 parents 628ae98 + a98b327 commit 8d96292

File tree

15 files changed

+213
-62
lines changed

15 files changed

+213
-62
lines changed

.github/actions/file/README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,26 @@ List of potential accessibility gaps (plus issue URLs), as stringified JSON. For
3636
'[]'
3737
```
3838

39+
#### `closed_issues`
40+
41+
List of closed issues’ `id`, `nodeId`, `url`, and `title`, as stringified JSON. For example: `'[{"id":1,"nodeId":"SXNzdWU6MQ==","url":"https://github.com/github/docs/issues/123","title":"Accessibility issue: 1"},{"id":2,"nodeId":"SXNzdWU6Mg==","url":"https://github.com/github/docs/issues/124","title":"Accessibility issue: 2"},{"id":4,"nodeId":"SXNzdWU6NA==","url":"https://github.com/github/docs/issues/126","title":"Accessibility issue: 4"}]'`.
42+
43+
#### `opened_issues`
44+
45+
List of newly-opened issues’ `id`, `nodeId`, `url`, and `title`, as stringified JSON. For example: `'[{"id":1,"nodeId":"SXNzdWU6MQ==","url":"https://github.com/github/docs/issues/123","title":"Accessibility issue: 1"},{"id":2,"nodeId":"SXNzdWU6Mg==","url":"https://github.com/github/docs/issues/124","title":"Accessibility issue: 2"},{"id":4,"nodeId":"SXNzdWU6NA==","url":"https://github.com/github/docs/issues/126","title":"Accessibility issue: 4"}]'`.
46+
47+
#### `repeated_issues`
48+
49+
List of repeated issues’ `id`, `nodeId`, `url`, and `title`, as stringified JSON. For example: `'[{"id":1,"nodeId":"SXNzdWU6MQ==","url":"https://github.com/github/docs/issues/123","title":"Accessibility issue: 1"},{"id":2,"nodeId":"SXNzdWU6Mg==","url":"https://github.com/github/docs/issues/124","title":"Accessibility issue: 2"},{"id":4,"nodeId":"SXNzdWU6NA==","url":"https://github.com/github/docs/issues/126","title":"Accessibility issue: 4"}]'`.
50+
3951
#### `closed_issue_urls`
4052

41-
List of URLs for closed issues, as stringified JSON. For example: `'["https://github.com/github/docs/issues/123","https://github.com/github/docs/issues/124","https://github.com/github/docs/issues/126","https://github.com/github/docs/issues/127"]'`.
53+
**DEPRECATED: This output will be removed in `v2`.** List of URLs for closed issues, as stringified JSON. For example: `'["https://github.com/github/docs/issues/123","https://github.com/github/docs/issues/124","https://github.com/github/docs/issues/126","https://github.com/github/docs/issues/127"]'`.
4254

4355
#### `opened_issue_urls`
4456

45-
List of URLs for newly-opened issues, as stringified JSON. For example: `'["https://github.com/github/docs/issues/123","https://github.com/github/docs/issues/124","https://github.com/github/docs/issues/126","https://github.com/github/docs/issues/127"]'`.
57+
**DEPRECATED: This output will be removed in `v2`.** List of URLs for newly-opened issues, as stringified JSON. For example: `'["https://github.com/github/docs/issues/123","https://github.com/github/docs/issues/124","https://github.com/github/docs/issues/126","https://github.com/github/docs/issues/127"]'`.
4658

4759
#### `repeated_issue_urls`
4860

49-
List of URLs for repeated issues, as stringified JSON. For example: `'["https://github.com/github/docs/issues/123","https://github.com/github/docs/issues/124","https://github.com/github/docs/issues/126","https://github.com/github/docs/issues/127"]'`.
61+
**DEPRECATED: This output will be removed in `v2`.** List of URLs for repeated issues, as stringified JSON. For example: `'["https://github.com/github/docs/issues/123","https://github.com/github/docs/issues/124","https://github.com/github/docs/issues/126","https://github.com/github/docs/issues/127"]'`.

.github/actions/file/action.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ inputs:
1818
outputs:
1919
findings:
2020
description: "List of potential accessibility gaps (plus issue URLs), as stringified JSON"
21+
closed_issues:
22+
description: "List of closed issues, as stringified JSON"
23+
opened_issues:
24+
description: "List of newly-opened issues, as stringified JSON"
25+
repeated_issues:
26+
description: "List of repeated issues, as stringified JSON"
2127
closed_issue_urls:
22-
description: "List of URLs for closed issues, as stringified JSON"
28+
description: "DEPRECATED: List of URLs for closed issues, as stringified JSON"
2329
opened_issue_urls:
24-
description: "List of URLs for newly-opened issues, as stringified JSON"
30+
description: "DEPRECATED: List of URLs for newly-opened issues, as stringified JSON"
2531
repeated_issue_urls:
26-
description: "List of URLs for repeated issues, as stringified JSON"
32+
description: "DEPRECATED: List of URLs for repeated issues, as stringified JSON"
2733

2834
runs:
2935
using: "node20"

.github/actions/file/src/index.ts

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Finding } from "./types.d.js";
1+
import type { Finding, Issue } from "./types.d.js";
22
import process from "node:process";
33
import core from "@actions/core";
44
import { Octokit } from "@octokit/core";
@@ -40,15 +40,27 @@ export default async function () {
4040
},
4141
}
4242
});
43-
const closedIssueUrls = [];
44-
const openedIssueUrls = [];
45-
const repeatIssueUrls = [];
43+
const closedIssues: Issue[] = [];
44+
const openedIssues: Issue[] = [];
45+
const repeatedIssues: Issue[] = [];
46+
/** @deprecated Use `closedIssues` instead. */
47+
const closedIssueUrls: string[] = [];
48+
/** @deprecated Use `openedIssues` instead. */
49+
const openedIssueUrls: string[] = [];
50+
/** @deprecated Use `repeatedIssues` instead. */
51+
const repeatedIssueUrls: string[] = [];
4652

4753
for (const cachedFinding of cachedFindings) {
4854
if (!findingsMap.has(`${cachedFinding.url};${cachedFinding.problemShort};${cachedFinding.html}`)) {
4955
try {
5056
// Finding was not found in the latest run, so close its issue (if necessary)
5157
const response = await closeIssueForFinding(octokit, repoWithOwner, cachedFinding);
58+
closedIssues.push({
59+
id: response.data.id,
60+
nodeId: response.data.node_id,
61+
url: response.data.html_url,
62+
title: response.data.title,
63+
});
5264
closedIssueUrls.push(response.data.html_url);
5365
core.info(`Closed issue: ${response.data.title} (${repoWithOwner}#${response.data.number})`);
5466
} catch (error) {
@@ -66,10 +78,22 @@ export default async function () {
6678
finding.issueUrl = response.data.html_url;
6779
if (response.data.html_url === cachedIssueUrl) {
6880
// Finding was found in previous and latest runs, so reopen its issue (if necessary)
69-
repeatIssueUrls.push(response.data.html_url);
81+
repeatedIssues.push({
82+
id: response.data.id,
83+
nodeId: response.data.node_id,
84+
url: response.data.html_url,
85+
title: response.data.title,
86+
});
87+
repeatedIssueUrls.push(response.data.html_url);
7088
core.info(`Repeated issue: ${response.data.title} (${repoWithOwner}#${response.data.number})`);
7189
} else {
7290
// New finding was found in the latest run, so create its issue
91+
openedIssues.push({
92+
id: response.data.id,
93+
nodeId: response.data.node_id,
94+
url: response.data.html_url,
95+
title: response.data.title,
96+
});
7397
openedIssueUrls.push(response.data.html_url);
7498
core.info(`Created issue: ${response.data.title} (${repoWithOwner}#${response.data.number})`);
7599
}
@@ -79,13 +103,25 @@ export default async function () {
79103
}
80104
}
81105

106+
core.setOutput("closed_issues", JSON.stringify(closedIssues));
107+
core.setOutput("opened_issues", JSON.stringify(openedIssues));
108+
core.setOutput("repeated_issues", JSON.stringify(repeatedIssues));
109+
core.setOutput("findings", JSON.stringify(findings));
110+
core.debug(`Output: 'closed_issues: ${JSON.stringify(closedIssues)}'`);
111+
core.debug(`Output: 'opened_issues: ${JSON.stringify(openedIssues)}'`);
112+
core.debug(`Output: 'repeated_issues: ${JSON.stringify(repeatedIssues)}'`);
113+
core.debug(`Output: 'findings: ${JSON.stringify(findings)}'`);
114+
115+
// Deprecated outputs
82116
core.setOutput("closed_issue_urls", JSON.stringify(closedIssueUrls));
83117
core.setOutput("opened_issue_urls", JSON.stringify(openedIssueUrls));
84-
core.setOutput("repeated_issue_urls", JSON.stringify(repeatIssueUrls));
85-
core.setOutput("findings", JSON.stringify(findings));
118+
core.setOutput("repeated_issue_urls", JSON.stringify(repeatedIssueUrls));
119+
core.warning("The 'closed_issue_urls' output is deprecated and will be removed in v2. If you use the 'closed_issue_urls' output, please migrate to the 'closed_issues' output.");
86120
core.debug(`Output: 'closed_issue_urls: ${JSON.stringify(closedIssueUrls)}'`);
121+
core.warning("The 'opened_issue_urls' output is deprecated and will be removed in v2. If you use the 'opened_issue_urls' output, please migrate to the 'opened_issues' output.");
87122
core.debug(`Output: 'opened_issue_urls: ${JSON.stringify(openedIssueUrls)}'`);
88-
core.debug(`Output: 'repeated_issue_urls: ${JSON.stringify(repeatIssueUrls)}'`);
89-
core.debug(`Output: 'findings: ${JSON.stringify(findings)}'`);
123+
core.warning("The 'repeated_issue_urls' output is deprecated and will be removed in v2. If you use the 'repeated_issue_urls' output, please migrate to the 'repeated_issues' output.");
124+
core.debug(`Output: 'repeated_issue_urls: ${JSON.stringify(repeatedIssueUrls)}'`);
125+
90126
core.info("Finished 'file' action");
91127
}

.github/actions/file/src/types.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,11 @@ export type Finding = {
88
solutionShort: string;
99
solutionLong?: string;
1010
issueUrl?: string;
11+
}
12+
13+
export type Issue = {
14+
id: number;
15+
nodeId: string;
16+
url: string;
17+
title: string;
1118
}

.github/actions/find/package-lock.json

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

.github/actions/find/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"dependencies": {
1616
"@actions/core": "^1.11.1",
1717
"@axe-core/playwright": "^4.10.2",
18-
"playwright": "^1.55.0"
18+
"playwright": "^1.55.1"
1919
},
2020
"devDependencies": {
2121
"@types/node": "^24.5.2",

.github/actions/find/src/findForUrl.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ export async function findForUrl(url: string): Promise<Finding[]> {
1515
scannerType: 'axe',
1616
url,
1717
html: violation.nodes[0].html,
18-
problemShort: violation.help.toLowerCase(),
19-
problemUrl: violation.helpUrl,
18+
problemShort: violation.help.toLowerCase().replace(/[']/g, '’'),
19+
problemUrl: violation.helpUrl.replace(/[']/g, '’'),
2020
ruleId: violation.id,
21-
solutionShort: violation.description.toLowerCase(),
22-
solutionLong: violation.nodes[0].failureSummary
21+
solutionShort: violation.description.toLowerCase().replace(/[']/g, '’'),
22+
solutionLong: violation.nodes[0].failureSummary?.replace(/[']/g, '’')
2323
}));
2424
} catch (e) {
2525
// do something with the error

.github/actions/fix/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ Attempts to fix issues with Copilot.
66

77
### Inputs
88

9+
#### `issues`
10+
11+
**NOTE: This input will be unconditionally required in `v2`.** **Required if `issue_urls` is not provided** List of issues to attempt to fix—including, at a minimum, their `url`s—as stringified JSON. For example: `'[{"url":"https://github.com/github/docs/issues/123"},{"nodeId":"SXNzdWU6Mg==","url":"https://github.com/github/docs/issues/124"},{"id":4,"nodeId":"SXNzdWU6NA==","url":"https://github.com/github/docs/issues/126","title":"Accessibility issue: 4"}]'`.
12+
913
#### `issue_urls`
1014

11-
**Required** List of issue URLs to attempt to fix, as stringified JSON. For example: `'["https://github.com/github/docs/issues/123","https://github.com/github/docs/issues/124","https://github.com/github/docs/issues/126","https://github.com/github/docs/issues/127"]'`.
15+
**DEPRECATED: This input will be removed in `v2`.** **Required if `issues` is not provided** List of issue URLs to attempt to fix, as stringified JSON. For example: `'["https://github.com/github/docs/issues/123","https://github.com/github/docs/issues/124","https://github.com/github/docs/issues/126","https://github.com/github/docs/issues/127"]'`. If both `issues` and `issue_urls` are provided, `issue_urls` will be ignored.
1216

1317
#### `repository`
1418

.github/actions/fix/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ name: "Fix"
22
description: "Attempts to fix issues with Copilot."
33

44
inputs:
5+
issues:
6+
description: "List of issues to attempt to fix, as stringified JSON"
7+
required: false
58
issue_urls:
69
description: "List of issue URLs to attempt to fix, as stringified JSON"
7-
required: true
10+
required: false
811
repository:
912
description: "Repository (with owner) containing issues"
1013
required: true

.github/actions/fix/src/Issue.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { IssueInput } from "./types.d.js";
2+
3+
interface IIssue extends IssueInput{
4+
owner: string;
5+
repository: string;
6+
issueNumber: number;
7+
}
8+
9+
export class Issue implements IIssue {
10+
/**
11+
* Extracts owner, repository, and issue number from a GitHub issue URL.
12+
* @param issueUrl A GitHub issue URL (e.g. `https://github.com/owner/repo/issues/42`).
13+
* @returns An object with `owner`, `repository`, and `issueNumber` keys.
14+
* @throws The provided URL is unparseable due to its unexpected format.
15+
*/
16+
static parseIssueUrl(issueUrl: string): { owner: string; repository: string; issueNumber: number } {
17+
const { owner, repository, issueNumber } = /\/(?<owner>[^/]+)\/(?<repository>[^/]+)\/issues\/(?<issueNumber>\d+)(?:[/?#]|$)/.exec(issueUrl)?.groups || {};
18+
if (!owner || !repository || !issueNumber) {
19+
throw new Error(`Could not parse issue URL: ${issueUrl}`);
20+
}
21+
return { owner, repository, issueNumber: Number(issueNumber) }
22+
}
23+
24+
url: string;
25+
nodeId?: string;
26+
27+
get owner(): string {
28+
return Issue.parseIssueUrl(this.url).owner;
29+
}
30+
31+
get repository(): string {
32+
return Issue.parseIssueUrl(this.url).repository;
33+
}
34+
35+
get issueNumber(): number {
36+
return Issue.parseIssueUrl(this.url).issueNumber;
37+
}
38+
39+
constructor({url, nodeId}: IssueInput) {
40+
this.url = url;
41+
this.nodeId = nodeId;
42+
}
43+
}

0 commit comments

Comments
 (0)