Skip to content
New issue

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

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

Already on GitHub? # to your account

Add a callable GitHub Action workflow that auto-restarts after a failure #3111

Closed
wants to merge 6 commits into from

Conversation

desrosj
Copy link
Contributor

@desrosj desrosj commented Aug 18, 2022

This workflow will restart a failed or cancelled workflow when it has only been run once.

This is dependent on actions/github-script#283, which will add the needed .rest.actions.reRunWorkflowFailedJobs() function added in octokit/plugin-rest-endpoint-methods.js@v5.14.0.

Trac ticket: https://core.trac.wordpress.org/ticket/56407


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@desrosj desrosj self-assigned this Aug 18, 2022
Copy link
Member

@aaronjorbin aaronjorbin left a comment

Choose a reason for hiding this comment

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

There is some inconsistency, where github.rest.actions.createWorkflowDispatch is sometimes called with const result = await and sometimes just called on it's own. I think one should be picked and used throughout

@desrosj
Copy link
Contributor Author

desrosj commented Aug 24, 2022

There is some inconsistency, where github.rest.actions.createWorkflowDispatch is sometimes called with const result = await and sometimes just called on it's own. I think one should be picked and used throughout

Ah, good spot. This was a relic from when I was debugging why the workflow_dispatch call was not working in my fork.

One thing that is not clear to me reading through the action's documentation is whether github-script will cause a step or job to fail if a non 2xx response code is returned by an API call. If not, using await and checking the response for a problem manually would be preferred. But for now I have removed the one instance of that in the coding standards workflow.

@desrosj
Copy link
Contributor Author

desrosj commented Aug 26, 2022

@desrosj desrosj closed this Aug 26, 2022
@desrosj desrosj deleted the trac/56407 branch August 26, 2022 19:19
@desrosj desrosj restored the trac/56407 branch September 14, 2022 00:37
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants