Skip to content

Commit 17ad6e5

Browse files
authored
Merge branch 'main' into copilot/add-baseurl-configuration-option
2 parents ffdf8ea + 04b72bd commit 17ad6e5

File tree

14 files changed

+164
-76
lines changed

14 files changed

+164
-76
lines changed

.github/actions/file/README.md

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ Files GitHub issues to track potential accessibility gaps.
66

77
### Inputs
88

9-
#### `findings`
9+
#### `findings_file`
1010

11-
**Required** List of potential accessibility gaps, as stringified JSON. For example:
11+
**Required** Path to a JSON file containing the list of potential accessibility gaps. The path can be absolute or relative to the working directory (which defaults to `GITHUB_WORKSPACE`). For example: `findings.json`.
1212

13-
```JS
14-
'[]'
13+
The file should contain a JSON array of finding objects. For example:
14+
```json
15+
[]
1516
```
1617

1718
#### `repository`
@@ -22,12 +23,32 @@ Files GitHub issues to track potential accessibility gaps.
2223

2324
**Required** Token with fine-grained permission 'issues: write'.
2425

25-
#### `cached_filings`
26+
#### `cached_filings_file`
2627

27-
**Optional** Cached filings from previous runs, as stringified JSON. Without this, duplicate issues may be filed. For example: `'[{"findings":[],"issue":{"id":1,"nodeId":"SXNzdWU6MQ==","url":"https://github.com/github/docs/issues/123","title":"Accessibility issue: 1"}}]'`
28+
**Optional** Path to a JSON file containing cached filings from previous runs. The path can be absolute or relative to the working directory (which defaults to `GITHUB_WORKSPACE`). Without this, duplicate issues may be filed. For example: `cached-filings.json`.
29+
30+
The file should contain a JSON array of filing objects. For example:
31+
```json
32+
[
33+
{
34+
"findings": [],
35+
"issue": {"id":1,"nodeId":"SXNzdWU6MQ==","url":"https://github.com/github/docs/issues/123","title":"Accessibility issue: 1"}
36+
}
37+
]
38+
```
2839

2940
### Outputs
3041

31-
#### `filings`
42+
#### `filings_file`
3243

33-
List of issues filed (and their associated finding(s)), as stringified JSON. For example: `'[{"findings":[],"issue":{"id":1,"nodeId":"SXNzdWU6MQ==","url":"https://github.com/github/docs/issues/123","title":"Accessibility issue: 1"}}]'`
44+
Absolute path to a JSON file containing the list of issues filed (and their associated finding(s)). The action writes this file to a temporary directory and returns the absolute path. For example: `$RUNNER_TEMP/filings-<uuid>.json`.
45+
46+
The file will contain a JSON array of filing objects. For example:
47+
```json
48+
[
49+
{
50+
"findings": [],
51+
"issue": {"id":1,"nodeId":"SXNzdWU6MQ==","url":"https://github.com/github/docs/issues/123","title":"Accessibility issue: 1"}
52+
}
53+
]
54+
```

.github/actions/file/action.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: "File"
22
description: "Files GitHub issues to track potential accessibility gaps."
33

44
inputs:
5-
findings:
6-
description: "List of potential accessibility gaps, as stringified JSON"
5+
findings_file:
6+
description: "Path to a JSON file containing the list of potential accessibility gaps"
77
required: true
88
repository:
99
description: "Repository (with owner) to file issues in"
@@ -14,8 +14,8 @@ inputs:
1414
base_url:
1515
description: "Optional base URL to pass into Octokit for the GitHub API (for example, `https://YOUR_HOSTNAME/api/v3` for GitHub Enterprise Server)"
1616
required: false
17-
cached_filings:
18-
description: "Cached filings from previous runs, as stringified JSON. Without this, duplicate issues may be filed."
17+
cached_filings_file:
18+
description: "Path to a JSON file containing cached filings from previous runs. Without this, duplicate issues may be filed."
1919
required: false
2020
screenshot_repository:
2121
description: "Repository (with owner) where screenshots are stored on the gh-cache branch. Defaults to the 'repository' input if not set. Required if issues are open in a different repo to construct proper screenshot URLs."
@@ -26,8 +26,8 @@ inputs:
2626
default: "false"
2727

2828
outputs:
29-
filings:
30-
description: "List of issues filed (and their associated finding(s)), as stringified JSON"
29+
filings_file:
30+
description: "Path to a JSON file containing the list of issues filed (and their associated finding(s))"
3131

3232
runs:
3333
using: "node24"

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import type {Finding, ResolvedFiling, RepeatedFiling, FindingGroupIssue, Filing, IssueResponse} from './types.d.js'
2+
import fs from 'node:fs'
3+
import path from 'node:path'
24
import process from 'node:process'
35
import * as core from '@actions/core'
46
import {Octokit} from '@octokit/core'
@@ -16,20 +18,22 @@ const OctokitWithThrottling = Octokit.plugin(throttling)
1618

1719
export default async function () {
1820
core.info("Started 'file' action")
19-
const findings: Finding[] = JSON.parse(core.getInput('findings', {required: true}))
21+
const findingsFile = core.getInput('findings_file', {required: true})
22+
const findings: Finding[] = JSON.parse(fs.readFileSync(findingsFile, 'utf8'))
2023
const repoWithOwner = core.getInput('repository', {required: true})
2124
const token = core.getInput('token', {required: true})
2225
const baseUrl = core.getInput('base_url', {required: false})
2326
const screenshotRepo = core.getInput('screenshot_repository', {required: false}) || repoWithOwner
24-
const cachedFilings: (ResolvedFiling | RepeatedFiling)[] = JSON.parse(
25-
core.getInput('cached_filings', {required: false}) || '[]',
26-
)
27+
const cachedFilingsFile = core.getInput('cached_filings_file', {required: false})
28+
const cachedFilings: (ResolvedFiling | RepeatedFiling)[] = cachedFilingsFile
29+
? JSON.parse(fs.readFileSync(cachedFilingsFile, 'utf8'))
30+
: []
2731
const shouldOpenGroupedIssues = core.getBooleanInput('open_grouped_issues')
28-
core.debug(`Input: 'findings: ${JSON.stringify(findings)}'`)
32+
core.debug(`Input: 'findings_file: ${findingsFile}'`)
2933
core.debug(`Input: 'repository: ${repoWithOwner}'`)
3034
core.debug(`Input: 'base_url: ${baseUrl ?? '(default)'}'`)
3135
core.debug(`Input: 'screenshot_repository: ${screenshotRepo}'`)
32-
core.debug(`Input: 'cached_filings: ${JSON.stringify(cachedFilings)}'`)
36+
core.debug(`Input: 'cached_filings_file: ${cachedFilingsFile}'`)
3337
core.debug(`Input: 'open_grouped_issues: ${shouldOpenGroupedIssues}'`)
3438

3539
const octokit = new OctokitWithThrottling({
@@ -134,7 +138,10 @@ export default async function () {
134138
}
135139
}
136140

137-
core.setOutput('filings', JSON.stringify(filings))
138-
core.debug(`Output: 'filings: ${JSON.stringify(filings)}'`)
141+
const filingsPath = path.join(process.env.RUNNER_TEMP || '/tmp', `filings-${crypto.randomUUID()}.json`)
142+
fs.writeFileSync(filingsPath, JSON.stringify(filings))
143+
core.setOutput('filings_file', filingsPath)
144+
145+
core.debug(`Output: 'filings_file: ${filingsPath}'`)
139146
core.info("Finished 'file' action")
140147
}

.github/actions/find/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ configuration option.
4141

4242
### Outputs
4343

44-
#### `findings`
44+
#### `findings_file`
4545

46-
List of potential accessibility gaps, as stringified JSON. For example:
46+
Absolute path to a JSON file containing the list of potential accessibility gaps. The action writes this file to a temporary directory and returns the absolute path. For example: `$RUNNER_TEMP/findings-<uuid>.json`.
4747

48-
```JS
49-
'[]'
48+
The file will contain a JSON array of finding objects. For example:
49+
```json
50+
[]
5051
```

.github/actions/find/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ inputs:
2424
required: false
2525

2626
outputs:
27-
findings:
28-
description: 'List of potential accessibility gaps, as stringified JSON'
27+
findings_file:
28+
description: 'Path to a JSON file containing the list of potential accessibility gaps'
2929

3030
runs:
3131
using: 'node24'

.github/actions/find/src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import type {AuthContextInput, ColorSchemePreference, ReducedMotionPreference} from './types.js'
2+
import fs from 'node:fs'
3+
import path from 'node:path'
24
import * as core from '@actions/core'
35
import {AuthContext} from './AuthContext.js'
46
import {findForUrl} from './findForUrl.js'
@@ -44,8 +46,11 @@ export default async function () {
4446
core.info(`Found ${findingsForUrl.length} findings for ${url}`)
4547
}
4648

47-
core.setOutput('findings', JSON.stringify(findings))
48-
core.debug(`Output: 'findings: ${JSON.stringify(findings)}'`)
49+
const findingsPath = path.join(process.env.RUNNER_TEMP || '/tmp', `findings-${crypto.randomUUID()}.json`)
50+
fs.writeFileSync(findingsPath, JSON.stringify(findings))
51+
core.setOutput('findings_file', findingsPath)
52+
53+
core.debug(`Output: 'findings_file: ${findingsPath}'`)
4954
core.info(`Found ${findings.length} findings in total`)
5055
core.info("Finished 'find' action")
5156
}

.github/actions/fix/README.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,18 @@ Attempts to fix issues with Copilot.
66

77
### Inputs
88

9-
#### `issues`
9+
#### `issues_file`
1010

11-
**Required** 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"}]'`.
11+
**Required** Path to a JSON file containing the list of issues to attempt to fix—including, at a minimum, their `url`s. The path can be absolute or relative to the working directory (which defaults to `GITHUB_WORKSPACE`). For example: `issues.json`.
12+
13+
The file should contain a JSON array of issue objects. For example:
14+
```json
15+
[
16+
{"url":"https://github.com/github/docs/issues/123"},
17+
{"nodeId":"SXNzdWU6Mg==","url":"https://github.com/github/docs/issues/124"},
18+
{"id":4,"nodeId":"SXNzdWU6NA==","url":"https://github.com/github/docs/issues/126","title":"Accessibility issue: 4"}
19+
]
20+
```
1221

1322
#### `repository`
1423

@@ -20,6 +29,16 @@ Attempts to fix issues with Copilot.
2029

2130
### Outputs
2231

23-
#### `fixings`
32+
#### `fixings_file`
33+
34+
Absolute path to a JSON file containing the list of pull requests filed (and their associated issues). The action writes this file to a temporary directory and returns the absolute path. For example: `$RUNNER_TEMP/fixings-<uuid>.json`.
2435

25-
List of pull requests filed (and their associated issues), as stringified JSON. For example: `'[{"issue":{"id":1,"nodeId":"SXNzdWU6MQ==","url":"https://github.com/github/docs/issues/123","title":"Accessibility issue: 1"},"pullRequest":{"url":"https://github.com/github/docs/pulls/124"}}]'`
36+
The file will contain a JSON array of fixing objects. For example:
37+
```json
38+
[
39+
{
40+
"issue": {"id":1,"nodeId":"SXNzdWU6MQ==","url":"https://github.com/github/docs/issues/123","title":"Accessibility issue: 1"},
41+
"pullRequest": {"url":"https://github.com/github/docs/pulls/124"}
42+
}
43+
]
44+
```

.github/actions/fix/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ 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"
5+
issues_file:
6+
description: "Path to a JSON file containing the list of issues to attempt to fix"
77
required: true
88
repository:
99
description: "Repository (with owner) containing issues"
@@ -16,8 +16,8 @@ inputs:
1616
required: false
1717

1818
outputs:
19-
fixings:
20-
description: "List of pull requests filed (and their associated issues), as stringified JSON"
19+
fixings_file:
20+
description: "Path to a JSON file containing the list of pull requests filed (and their associated issues)"
2121

2222
runs:
2323
using: "node24"

.github/actions/fix/src/index.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import type {Issue as IssueInput, Fixing} from './types.d.js'
2+
import fs from 'node:fs'
3+
import path from 'node:path'
24
import process from 'node:process'
35
import * as core from '@actions/core'
46
import {Octokit} from '@octokit/core'
@@ -11,11 +13,12 @@ const OctokitWithThrottling = Octokit.plugin(throttling)
1113

1214
export default async function () {
1315
core.info("Started 'fix' action")
14-
const issues: IssueInput[] = JSON.parse(core.getInput('issues', {required: true}) || '[]')
16+
const issuesFile = core.getInput('issues_file', {required: true})
17+
const issues: IssueInput[] = JSON.parse(fs.readFileSync(issuesFile, 'utf8'))
1518
const repoWithOwner = core.getInput('repository', {required: true})
1619
const token = core.getInput('token', {required: true})
1720
const baseUrl = core.getInput('base_url', {required: false}) || undefined
18-
core.debug(`Input: 'issues: ${JSON.stringify(issues)}'`)
21+
core.debug(`Input: 'issues_file: ${issuesFile}'`)
1922
core.debug(`Input: 'repository: ${repoWithOwner}'`)
2023
core.debug(`Input: 'base_url: ${baseUrl ?? '(default)'}'`)
2124

@@ -59,7 +62,10 @@ export default async function () {
5962
}
6063
}
6164

62-
core.setOutput('fixings', JSON.stringify(fixings))
63-
core.debug(`Output: 'fixings: ${JSON.stringify(fixings)}'`)
65+
const fixingsPath = path.join(process.env.RUNNER_TEMP || '/tmp', `fixings-${crypto.randomUUID()}.json`)
66+
fs.writeFileSync(fixingsPath, JSON.stringify(fixings))
67+
core.setOutput('fixings_file', fixingsPath)
68+
69+
core.debug(`Output: 'fixings_file: ${fixingsPath}'`)
6470
core.info("Finished 'fix' action")
6571
}

.github/actions/gh-cache/cache/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ runs:
6363
echo "value<<EOF" >> $GITHUB_OUTPUT
6464
if [ -f "${{ inputs.key }}" ]; then
6565
cat "${{ inputs.key }}" >> $GITHUB_OUTPUT
66+
echo >> $GITHUB_OUTPUT
6667
echo "Outputted 'value=$(cat "${{ inputs.key }}")'"
6768
else
6869
echo "Skipped outputting 'value'"

0 commit comments

Comments
 (0)