@@ -115,22 +115,32 @@ jobs:
115
115
shopt -s globstar
116
116
python .github/workflows/format-report.py logs/**/*-log sphinx-log.txt
117
117
- name : Report failures
118
- uses : actions/github-script@v6
118
+ uses : actions/github-script@v7
119
119
with :
120
- github-token : ${{ secrets.GITHUB_TOKEN }}
120
+ github-token : ${{ github.token }}
121
121
script : |
122
- const fs = require('fs');
123
- const sphinx_logs = fs.readFileSync('sphinx-logs.txt', 'utf8');
124
- const title = "⚠️ Nightly upstream-dev CI failed ⚠️"
125
- const workflow_url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
126
- const issue_body = `[Workflow Run URL](${workflow_url})\n${sphinx_logs}`
122
+ const fs = require("fs");
123
+ const sphinx_logs = fs.readFileSync("sphinx-logs.txt", "utf8");
124
+ const title = "⚠️ Nightly upstream-dev CI failed ⚠️";
125
+ const workflow_url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
126
+ const issue_body = `[Workflow Run URL](${workflow_url})\n${sphinx_logs}`;
127
+
128
+ const variables = {
129
+ owner: context.repo.owner,
130
+ name: context.repo.repo,
131
+ label: "CI"
132
+ creator: "app/github-actions",
133
+ title: title,
134
+ };
135
+
136
+ const query_string = `repo:${variables.owner}/${variables.name} author:${variables.creator} label:${variables:label} is:open in:title ${variables.title}`;
127
137
128
138
// Run GraphQL query against GitHub API to find the most recent open issue used for reporting failures
129
- const query = `query($owner:String!, $name:String!, $creator:String!, $label:String!) {
130
- repository(owner: $owner, name: $name ) {
131
- issues(first: 1, states: OPEN, filterBy: {createdBy: $creator, labels: [$label]}, orderBy: {field: CREATED_AT, direction: DESC}) {
132
- edges {
133
- node {
139
+ const query = `query {
140
+ search(query: "${query_string}", type:ISSUE, first: 1 ) {
141
+ edges {
142
+ node {
143
+ ... on Issue {
134
144
body
135
145
id
136
146
number
@@ -140,13 +150,7 @@ jobs:
140
150
}
141
151
}`;
142
152
143
- const variables = {
144
- owner: context.repo.owner,
145
- name: context.repo.repo,
146
- label: 'CI',
147
- creator: "github-actions[bot]"
148
- }
149
- const result = await github.graphql(query, variables)
153
+ const result = await github.graphql(query);
150
154
151
155
// If no issue is open, create a new issue,
152
156
// else update the body of the existing issue.
@@ -157,12 +161,12 @@ jobs:
157
161
body: issue_body,
158
162
title: title,
159
163
labels: [variables.label]
160
- })
164
+ });
161
165
} else {
162
166
github.rest.issues.update({
163
167
owner: variables.owner,
164
168
repo: variables.name,
165
169
issue_number: result.repository.issues.edges[0].node.number,
166
170
body: issue_body
167
- })
171
+ });
168
172
}
0 commit comments