Skip to content

Commit 7042dd2

Browse files
authored
Fix lint-go failure and enrich CGO failure issues with direct job links and expiration markers (#28615)
1 parent 9968781 commit 7042dd2

4 files changed

Lines changed: 48 additions & 7 deletions

File tree

.github/workflows/cgo.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1750,9 +1750,34 @@ jobs:
17501750
}
17511751
}
17521752
1753+
// Fetch all jobs for this run to get direct job links
1754+
const jobsResponse = await github.rest.actions.listJobsForWorkflowRun({
1755+
owner: context.repo.owner,
1756+
repo: context.repo.repo,
1757+
run_id: context.runId,
1758+
per_page: 100,
1759+
});
1760+
1761+
// Build a map from job name to job URL for failed jobs
1762+
const jobUrlMap = {};
1763+
for (const job of jobsResponse.data.jobs) {
1764+
if (failedJobs.includes(job.name)) {
1765+
jobUrlMap[job.name] = job.html_url;
1766+
}
1767+
}
1768+
17531769
const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
17541770
const expiresAt = new Date(Date.now() + 4 * 60 * 60 * 1000).toISOString();
17551771
1772+
// Format expiration line using the gh-aw-expires XML comment format
1773+
const expiresDate = new Date(expiresAt);
1774+
const humanReadableDate = expiresDate.toLocaleString('en-US', {
1775+
dateStyle: 'medium',
1776+
timeStyle: 'short',
1777+
timeZone: 'UTC',
1778+
});
1779+
const expirationLine = `- [x] expires <!-- gh-aw-expires: ${expiresAt} --> on ${humanReadableDate} UTC`;
1780+
17561781
const body = [
17571782
`## CGO Workflow Failure`,
17581783
``,
@@ -1766,9 +1791,13 @@ jobs:
17661791
``,
17671792
`## Failed Jobs`,
17681793
``,
1769-
...failedJobs.map(name => `- \`${name}\``),
1794+
// Map job names to direct links; fall back to plain text if a job ID wasn't found
1795+
...failedJobs.map(name => jobUrlMap[name]
1796+
? `- [\`${name}\`](${jobUrlMap[name]})`
1797+
: `- \`${name}\``),
17701798
``,
17711799
`> This issue expires at ${expiresAt}. Please investigate the failed jobs above and close once resolved.`,
1800+
`> ${expirationLine}`,
17721801
].join('\n');
17731802
17741803
const issue = await github.rest.issues.create({

docs/src/content/docs/agent-factory-status.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ These are experimental agentic workflows used by the GitHub Next team to learn,
9999
| [Delight](https://github.com/github/gh-aw/blob/main/.github/workflows/delight.md) | copilot | [![Delight](https://github.com/github/gh-aw/actions/workflows/delight.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/delight.lock.yml) | - | - |
100100
| [Dependabot Burner](https://github.com/github/gh-aw/blob/main/.github/workflows/dependabot-burner.md) | copilot | [![Dependabot Burner](https://github.com/github/gh-aw/actions/workflows/dependabot-burner.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/dependabot-burner.lock.yml) | - | - |
101101
| [Dependabot Dependency Checker](https://github.com/github/gh-aw/blob/main/.github/workflows/dependabot-go-checker.md) | copilot | [![Dependabot Dependency Checker](https://github.com/github/gh-aw/actions/workflows/dependabot-go-checker.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/dependabot-go-checker.lock.yml) | `20 9 * * 1,3,5` | - |
102+
| [Deployment Incident Monitor](https://github.com/github/gh-aw/blob/main/.github/workflows/deployment-incident-monitor.md) | copilot | [![Deployment Incident Monitor](https://github.com/github/gh-aw/actions/workflows/deployment-incident-monitor.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/deployment-incident-monitor.lock.yml) | - | - |
102103
| [Design Decision Gate 🏗️](https://github.com/github/gh-aw/blob/main/.github/workflows/design-decision-gate.md) | claude | [![Design Decision Gate 🏗️](https://github.com/github/gh-aw/actions/workflows/design-decision-gate.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/design-decision-gate.lock.yml) | - | - |
103104
| [Dev](https://github.com/github/gh-aw/blob/main/.github/workflows/dev.md) | copilot | [![Dev](https://github.com/github/gh-aw/actions/workflows/dev.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/dev.lock.yml) | `daily around 9:00` | - |
104105
| [Dev Hawk](https://github.com/github/gh-aw/blob/main/.github/workflows/dev-hawk.md) | copilot | [![Dev Hawk](https://github.com/github/gh-aw/actions/workflows/dev-hawk.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/dev-hawk.lock.yml) | - | - |

docs/src/content/docs/reference/frontmatter-full.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,17 @@ on:
482482

483483
# Option 2: object
484484
deployment_status:
485-
{}
485+
# Filter to specific deployment states (compiled into if condition). Use a string
486+
# for one state or an array for multiple states.
487+
# (optional)
488+
# This field supports multiple formats (oneOf):
489+
490+
# Option 1: string
491+
state: "error"
492+
493+
# Option 2: array
494+
state: []
495+
# Array items: string
486496

487497
# Fork event trigger that runs when someone forks the repository
488498
# (optional)
@@ -3595,7 +3605,7 @@ safe-outputs:
35953605
github-token-for-extra-empty-commit: "example-value"
35963606

35973607
# Controls protected-file protection. String form: blocked (default), allowed, or
3598-
# fallback-to-issue. Object form: { policy, exclude } to customize the
3608+
# fallback-to-issue. Object form: { policy, exclude } to customise the
35993609
# protected-file set.
36003610
# (optional)
36013611
# This field supports multiple formats (oneOf):
@@ -4777,7 +4787,7 @@ safe-outputs:
47774787
# Array of strings
47784788

47794789
# Controls protected-file protection. String form: blocked (default), allowed, or
4780-
# fallback-to-issue. Object form: { policy, exclude } to customize the
4790+
# fallback-to-issue. Object form: { policy, exclude } to customise the
47814791
# protected-file set.
47824792
# (optional)
47834793
# This field supports multiple formats (oneOf):
@@ -5298,7 +5308,7 @@ safe-outputs:
52985308
# Default values injected when the model omits a field
52995309
# (optional)
53005310
defaults:
5301-
# Behavior when no files match: 'error' (default) or 'ignore'
5311+
# Behaviour when no files match: 'error' (default) or 'ignore'
53025312
# (optional)
53035313
if-no-files: "error"
53045314

pkg/gitutil/spec_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"testing"
88

99
"github.com/stretchr/testify/assert"
10+
"github.com/stretchr/testify/require"
1011
)
1112

1213
// TestSpec_PublicAPI_IsRateLimitError validates the documented behavior of
@@ -274,7 +275,7 @@ func TestSpec_PublicAPI_IsValidFullSHA(t *testing.T) {
274275
func TestSpec_PublicAPI_FindGitRoot(t *testing.T) {
275276
t.Run("returns non-empty absolute path when in git repository", func(t *testing.T) {
276277
root, err := FindGitRoot()
277-
assert.NoError(t, err, "FindGitRoot should not error when inside a git repository")
278+
require.NoError(t, err, "FindGitRoot should not error when inside a git repository")
278279
assert.NotEmpty(t, root, "FindGitRoot should return a non-empty path")
279280
assert.True(t, filepath.IsAbs(root),
280281
"FindGitRoot should return an absolute path, got %q", root)
@@ -295,7 +296,7 @@ func TestSpec_PublicAPI_ReadFileFromHEADWithRoot(t *testing.T) {
295296

296297
t.Run("reads known file from HEAD without error", func(t *testing.T) {
297298
content, err := ReadFileFromHEADWithRoot(filepath.Join(root, "go.mod"), root)
298-
assert.NoError(t, err, "ReadFileFromHEADWithRoot should read go.mod without error")
299+
require.NoError(t, err, "ReadFileFromHEADWithRoot should read go.mod without error")
299300
assert.NotEmpty(t, content, "content of go.mod should not be empty")
300301
})
301302

0 commit comments

Comments
 (0)