21
21
fail-fast : false
22
22
matrix :
23
23
python-version : ["3.8"]
24
+ outputs :
25
+ artifacts_availability : ${{ steps.status.outputs.ARTIFACTS_AVAILABLE }}
24
26
steps :
25
27
- name : Cancel previous runs
26
28
30
32
- uses : conda-incubator/setup-miniconda@v2
31
33
with :
32
34
channels : conda-forge
35
+ channel-priority : strict
33
36
mamba-version : " *"
34
37
activate-environment : xarray-tests
35
38
auto-update-conda : false
@@ -40,12 +43,17 @@ jobs:
40
43
bash ci/install-upstream-wheels.sh
41
44
conda list
42
45
- name : Run Tests
46
+ id : status
43
47
run : |
44
- set -o pipefail
45
- python -m pytest -rf | tee output-${{ matrix.python-version }}-log
46
-
48
+ set -euo pipefail
49
+ python -m pytest -rf | tee output-${{ matrix.python-version }}-log || (
50
+ echo '::set-output name=ARTIFACTS_AVAILABLE::true' && false
51
+ )
47
52
- name : Upload artifacts
48
- if : " failure()&&(github.event_name == 'schedule')&&(github.repository == 'pydata/xarray')" # Check the exit code of previous step
53
+ if : |
54
+ failure()
55
+ && github.event_name == 'schedule'
56
+ && github.repository == 'pydata/xarray'
49
57
uses : actions/upload-artifact@v2
50
58
with :
51
59
name : output-${{ matrix.python-version }}-log
55
63
report :
56
64
name : report
57
65
needs : upstream-dev
58
- if : " always()&&(github.event_name == 'schedule')&&(github.repository == 'pydata/xarray')"
66
+ if : |
67
+ always()
68
+ && github.event_name == 'schedule'
69
+ && github.repository == 'pydata/xarray'
70
+ && needs.upstream-dev.outputs.artifacts_availability == 'true'
59
71
runs-on : ubuntu-latest
60
72
defaults :
61
73
run :
86
98
const title = "⚠️ Nightly upstream-dev CI failed ⚠️"
87
99
const workflow_url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
88
100
const issue_body = `[Workflow Run URL](${workflow_url})\n${pytest_logs}`
89
-
101
+
90
102
// Run GraphQL query against GitHub API to find the most recent open issue used for reporting failures
91
103
const query = `query($owner:String!, $name:String!, $creator:String!, $label:String!){
92
104
repository(owner: $owner, name: $name) {
@@ -109,11 +121,10 @@ jobs:
109
121
creator: "github-actions[bot]"
110
122
}
111
123
const result = await github.graphql(query, variables)
112
- const issue_info = result.repository.issues.edges[0].node
113
124
114
- // If no issue is open, create a new issue, else update the
115
- // body of the existing issue.
116
- if (typeof issue_info.number === 'undefined' ) {
125
+ // If no issue is open, create a new issue,
126
+ // else update the body of the existing issue.
127
+ if (result.repository.issues.edges.length === 0 ) {
117
128
github.issues.create({
118
129
owner: variables.owner,
119
130
repo: variables.name,
@@ -125,7 +136,7 @@ jobs:
125
136
github.issues.update({
126
137
owner: variables.owner,
127
138
repo: variables.name,
128
- issue_number: issue_info .number,
139
+ issue_number: result.repository.issues.edges[0].node .number,
129
140
body: issue_body
130
141
})
131
142
}
0 commit comments