diff --git a/.github/workflows/upstream-dev-ci.yaml b/.github/workflows/upstream-dev-ci.yaml index 8b8af79..5d3f6be 100644 --- a/.github/workflows/upstream-dev-ci.yaml +++ b/.github/workflows/upstream-dev-ci.yaml @@ -29,6 +29,8 @@ jobs: id: conda uses: mamba-org/provision-with-micromamba@main with: + channel-priority: strict + cache-env: true cache-downloads: true micromamba-version: 'latest' environment-file: ci/environment-upstream-dev.yml @@ -42,51 +44,17 @@ jobs: conda list - name: Run Tests - id: test + if: success() + id: status run: | - python -m pytest - - - name: Report Status + python -m pytest -rf \ + --report-log output-log.jsonl + - name: Generate and publish the report if: | - always() - && (steps.conda.outcome != 'success' || steps.install.outcome != 'success' || steps.install.outcome != 'success') - uses: actions/github-script@v6 + failure() + && steps.status.outcome == 'failure' + && github.event_name == 'schedule' + && github.repository_owner == 'ncar-xdev' + uses: xarray-contrib/issue-from-pytest-log@v0.1 with: - script: | - const title = '⚠️ Upstream CI Failed ⚠️' - const creator = 'github-actions[bot]' - const issueLabel = 'CI' - const workflow_url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}` - const issue_body = `[Workflow Run URL](${workflow_url})\n\n` - let foundIssue = false - const issues = await github.rest.issues.listForRepo({ - owner: context.repo.owner, - repo: context.repo.repo, - }) - for (let issue of issues.data) { - if ( - issue.user.login === creator && - issue.state === 'open' && - issue.labels.some((label) => label.name === issueLabel) - ) { - github.rest.issues.update({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issue.number, - body: issue_body, - }) - core.info(`Updated an existing issue: ${issue.number}.`) - foundIssue = true - break - } - } - if (!foundIssue) { - await github.rest.issues.create({ - owner: context.repo.owner, - repo: context.repo.repo, - title: title, - body: issue_body, - labels: [issueLabel], - }) - core.info('Opened a new issue') - } + log-path: output-log.jsonl