Skip to content

Commit 66905a8

Browse files
authored
Merge branch 'master' into copilot/enhance-onboarding-user-flow-again
2 parents 967801d + 9657787 commit 66905a8

File tree

3 files changed

+261
-252
lines changed

3 files changed

+261
-252
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Build Verification
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
name: Build Website
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
issues: write # Required to create issues
19+
steps:
20+
- uses: actions/checkout@v6
21+
22+
- uses: actions/setup-node@v6
23+
with:
24+
node-version: 20
25+
cache: yarn
26+
27+
- name: Install dependencies
28+
run: yarn install
29+
30+
- name: Build website
31+
id: build
32+
run: yarn build
33+
continue-on-error: true
34+
35+
- name: Create issue on build failure
36+
if: steps.build.outcome == 'failure'
37+
uses: actions/github-script@v7
38+
with:
39+
script: |
40+
const buildUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
41+
const issueTitle = `Build Failed: ${process.env.GITHUB_REF_NAME}`;
42+
const issueBody = `## Build Failure Report
43+
44+
The website build has failed.
45+
46+
**Branch:** ${process.env.GITHUB_REF_NAME}
47+
**Commit:** ${process.env.GITHUB_SHA}
48+
**Workflow Run:** ${buildUrl}
49+
**Triggered by:** ${process.env.GITHUB_ACTOR}
50+
51+
Please check the workflow logs for details on the build failure.
52+
`;
53+
54+
// Check if there's already an open issue for this
55+
const issues = await github.rest.issues.listForRepo({
56+
owner: context.repo.owner,
57+
repo: context.repo.repo,
58+
state: 'open',
59+
labels: 'build-failure',
60+
per_page: 100
61+
});
62+
63+
const existingIssue = issues.data.find(issue =>
64+
issue.title === issueTitle
65+
);
66+
67+
if (existingIssue) {
68+
// Comment on existing issue
69+
await github.rest.issues.createComment({
70+
owner: context.repo.owner,
71+
repo: context.repo.repo,
72+
issue_number: existingIssue.number,
73+
body: `Build failed again.\n\n**New Run:** ${buildUrl}\n**Commit:** ${process.env.GITHUB_SHA}`
74+
});
75+
console.log(`Commented on existing issue #${existingIssue.number}`);
76+
} else {
77+
// Create new issue
78+
try {
79+
const issue = await github.rest.issues.create({
80+
owner: context.repo.owner,
81+
repo: context.repo.repo,
82+
title: issueTitle,
83+
body: issueBody,
84+
labels: ['build-failure'],
85+
assignees: ['copilot']
86+
});
87+
console.log(`Created issue #${issue.data.number}`);
88+
} catch (error) {
89+
// If assigning to 'copilot' fails, create issue without assignee
90+
console.log(`Failed to assign to copilot: ${error.message}`);
91+
const issue = await github.rest.issues.create({
92+
owner: context.repo.owner,
93+
repo: context.repo.repo,
94+
title: issueTitle,
95+
body: issueBody,
96+
labels: ['build-failure']
97+
});
98+
console.log(`Created issue #${issue.data.number} without assignee`);
99+
}
100+
}
101+
102+
- name: Fail the workflow if build failed
103+
if: steps.build.outcome == 'failure'
104+
run: exit 1

sidebars.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ const sidebars = {
117117
items: [
118118
"Keywords/CLI/Terminal_Actions",
119119
"Keywords/CLI/File_Actions",
120-
},
120+
],
121+
},
121122
{
122123
type: 'category',
123124
label: 'DB',

0 commit comments

Comments
 (0)