10
10
- cron : " 0 0 * * *" # Daily "At 00:00" UTC
11
11
workflow_dispatch :
12
12
13
+ concurrency :
14
+ group : ${{ github.workflow }}-${{ github.ref }}
15
+ cancel-in-progress : true
16
+
13
17
jobs :
14
18
detect-test-upstream-trigger :
15
19
name : " Detect CI Trigger: [test-upstream]"
18
22
outputs :
19
23
triggered : ${{ steps.detect-trigger.outputs.trigger-found }}
20
24
steps :
21
- - uses : actions/checkout@v2
25
+ - uses : actions/checkout@v3
22
26
with :
23
27
fetch-depth : 2
24
28
@@ -49,19 +53,14 @@ jobs:
49
53
artifacts_availability : ${{ steps.status.outputs.ARTIFACTS_AVAILABLE }}
50
54
51
55
steps :
52
- - name : cancel previous runs
53
-
54
- with :
55
- access_token : ${{ github.token }}
56
-
57
56
- name : checkout the repository
58
- uses : actions/checkout@v2
57
+ uses : actions/checkout@v3
59
58
with :
60
59
# need to fetch all tags to get a correct version
61
60
fetch-depth : 0 # fetch all branches and tags
62
61
63
62
- name : setup python
64
- uses : actions/setup-python@v2
63
+ uses : actions/setup-python@v3
65
64
with :
66
65
python-version : ${{ matrix.python-version }}
67
66
@@ -116,9 +115,9 @@ jobs:
116
115
&& needs.upstream-dev.outputs.artifacts_availability == 'true'
117
116
steps :
118
117
- name : checkout the repository
119
- uses : actions/checkout@v2
118
+ uses : actions/checkout@v3
120
119
- name : setup python
121
- uses : actions/setup-python@v2
120
+ uses : actions/setup-python@v3
122
121
with :
123
122
python-version : " 3.x"
124
123
- uses : actions/download-artifact@v2
@@ -133,55 +132,54 @@ jobs:
133
132
shopt -s globstar
134
133
python .github/workflows/parse_logs.py logs/**/*-log
135
134
- name : Report failures
136
- uses : actions/github-script@v3
135
+ uses : actions/github-script@v6
137
136
with :
138
137
github-token : ${{ secrets.GITHUB_TOKEN }}
139
138
script : |
140
- const fs = require('fs');
141
- const pytest_logs = fs.readFileSync('pytest-logs.txt', 'utf8');
142
- const title = "⚠️ Nightly upstream-dev CI failed ⚠️"
143
- const workflow_url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
144
- const issue_body = `[Workflow Run URL](${workflow_url})\n${pytest_logs}`
145
-
146
- // Run GraphQL query against GitHub API to find the most recent open issue used for reporting failures
147
- const query = `query($owner:String!, $name:String!, $creator:String!, $label:String!){
148
- repository(owner: $owner, name: $name) {
149
- issues(first: 1, states: OPEN, filterBy: {createdBy: $creator, labels: [$label]}, orderBy: {field: CREATED_AT, direction: DESC}) {
150
- edges {
151
- node {
152
- body
153
- id
154
- number
139
+ const fs = require('fs');
140
+ const pytest_logs = fs.readFileSync('pytest-logs.txt', 'utf8');
141
+ const title = "⚠️ Nightly upstream-dev CI failed ⚠️"
142
+ const workflow_url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
143
+ const issue_body = `[Workflow Run URL](${workflow_url})\n${pytest_logs}`
144
+
145
+ // Run GraphQL query against GitHub API to find the most recent open issue used for reporting failures
146
+ const query = `query($owner:String!, $name:String!, $creator:String!, $label:String!){
147
+ repository(owner: $owner, name: $name) {
148
+ issues(first: 1, states: OPEN, filterBy: {createdBy: $creator, labels: [$label]}, orderBy: {field: CREATED_AT, direction: DESC}) {
149
+ edges {
150
+ node {
151
+ body
152
+ id
153
+ number
154
+ }
155
155
}
156
156
}
157
157
}
158
+ }`;
159
+
160
+ const variables = {
161
+ owner: context.repo.owner,
162
+ name: context.repo.repo,
163
+ label: 'CI',
164
+ creator: "github-actions[bot]"
165
+ }
166
+ const result = await github.graphql(query, variables)
167
+
168
+ // If no issue is open, create a new issue,
169
+ // else update the body of the existing issue.
170
+ if (result.repository.issues.edges.length === 0) {
171
+ github.rest.issues.create({
172
+ owner: variables.owner,
173
+ repo: variables.name,
174
+ body: issue_body,
175
+ title: title,
176
+ labels: [variables.label]
177
+ })
178
+ } else {
179
+ github.rest.issues.update({
180
+ owner: variables.owner,
181
+ repo: variables.name,
182
+ issue_number: result.repository.issues.edges[0].node.number,
183
+ body: issue_body
184
+ })
158
185
}
159
- }`;
160
-
161
- const variables = {
162
- owner: context.repo.owner,
163
- name: context.repo.repo,
164
- label: 'CI',
165
- creator: "github-actions[bot]"
166
- }
167
- const result = await github.graphql(query, variables)
168
-
169
- // If no issue is open, create a new issue,
170
- // else update the body of the existing issue.
171
- if (result.repository.issues.edges.length === 0) {
172
- github.issues.create({
173
- owner: variables.owner,
174
- repo: variables.name,
175
- body: issue_body,
176
- title: title,
177
- labels: [variables.label]
178
- })
179
- } else {
180
- github.issues.update({
181
- owner: variables.owner,
182
- repo: variables.name,
183
- issue_number: issue_info.number,
184
- issue_number: result.repository.issues.edges[0].node.number,
185
- body: issue_body
186
- })
187
- }
0 commit comments