Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the new action to create an issue from the output of report log #137

Merged
merged 1 commit into from
Oct 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 13 additions & 45 deletions .github/workflows/upstream-dev-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/[email protected]
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