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

Add reusable workflow for workflow failure reporting #121

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

victorlin
Copy link
Member

@victorlin victorlin commented Feb 8, 2025

Description of proposed changes

Taken from conda-base after generalizations¹ and further adjustments.

¹ nextstrain/conda-base@d7d23af...3c01cf9

Related issue(s)

Motivated by desire to do the same thing in another repository: nextstrain/cli#412

Checklist

@victorlin victorlin self-assigned this Feb 8, 2025
@victorlin victorlin force-pushed the victorlin/report-failure branch 4 times, most recently from 936987c to 2825ebc Compare February 8, 2025 05:12
Taken from conda-base after generalizations¹ and further adjustments.

¹ <nextstrain/conda-base@d7d23af...3c01cf9>
Copy link
Contributor

@joverlee521 joverlee521 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @victorlin! This should be useful for a lot of repos. We can even consider if we want to use it for the automated pathogen workflows.

I'm considering using this for the nextstrain/status CI workflow. However, that workflow has a history of temporary failures, so it might be get noisy.

Comment on lines 36 to 41
# Search for issues opened by this job.
matching_issues=$(gh issue list \
--state open \
--author '@me' \
--json 'number,title' \
--jq 'map(select(.title == "${{ inputs.title }}") | .number)')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking question

Should there be some filter on the branch of the workflow? Or I guess the calling workflow can control if report-failure.yaml only gets run on the default branch...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's outside the scope of this reusable workflow. There could be a valid reason for the calling workflow to open issues regardless of branch. Yes, I've encoded this in the calling workflow for conda-base, cli PRs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah that makes sense. I guess the title can include the branch of the workflow to make sure this matches issues per branch.

Maybe the inputs.title.description should explicitly state that the title is used for issue matching.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done as part of cfa7538

@victorlin
Copy link
Member Author

I'm considering using this for the nextstrain/status CI workflow. However, that workflow has a history of temporary failures, so it might be get noisy.

Same thing with the nextstrain/cli CI workflow. I think in general it will be nice to have the issue automation in place, even if we decide to disable it temporarily during periods of unstable CI. If we find ourselves disabling it more than it's enabled, it's maybe a sign that CI status is not useful and that we should rework the steps to improve reliability.

Comment on lines +81 to +86
body: |
Automatically created by the workflow [${{ github.workflow }}](${{ env.workflow_link }}) which indicated failure on [run ${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).

See the workflow run for details and make changes as necessary.

This issue will be automatically closed upon the next successful run of the workflow.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue title has been parameterized to the required inputs.title but the issue body is fixed. I'm thinking it would be better to use this as default, but allow customization through inputs.body.

This behavior is an essential part of the workflow, and should be
documented more clearly, including the making explicit the default
--limit 30.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants