Skip to content

Commit 11392a0

Browse files
Bump actions/github-script from 6 to 7 (#114)
* Bump actions/github-script from 6 to 7 Bumps [actions/github-script](https://github.com/actions/github-script) from 6 to 7. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](actions/github-script@v6...v7) --- updated-dependencies: - dependency-name: actions/github-script dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * rewrite the github script --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Justus Magin <[email protected]>
1 parent c6a3ef6 commit 11392a0

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

.github/workflows/nightly.yaml

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -115,22 +115,32 @@ jobs:
115115
shopt -s globstar
116116
python .github/workflows/format-report.py logs/**/*-log sphinx-log.txt
117117
- name: Report failures
118-
uses: actions/github-script@v6
118+
uses: actions/github-script@v7
119119
with:
120-
github-token: ${{ secrets.GITHUB_TOKEN }}
120+
github-token: ${{ github.token }}
121121
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}`;
127137
128138
// 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 {
134144
body
135145
id
136146
number
@@ -140,13 +150,7 @@ jobs:
140150
}
141151
}`;
142152
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);
150154
151155
// If no issue is open, create a new issue,
152156
// else update the body of the existing issue.
@@ -157,12 +161,12 @@ jobs:
157161
body: issue_body,
158162
title: title,
159163
labels: [variables.label]
160-
})
164+
});
161165
} else {
162166
github.rest.issues.update({
163167
owner: variables.owner,
164168
repo: variables.name,
165169
issue_number: result.repository.issues.edges[0].node.number,
166170
body: issue_body
167-
})
171+
});
168172
}

0 commit comments

Comments
 (0)