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 auto-cancellation workflow #2361

Merged
merged 7 commits into from
Nov 13, 2020

Conversation

aaemnnosttv
Copy link
Collaborator

@aaemnnosttv aaemnnosttv commented Nov 13, 2020

Summary

Addresses issue #2027

Relevant technical choices

  • Used dedicated workflow for cancelling all relevant workflows rather than updating individual flows and allows for cancelling a workflow before it runs

Testing

Screenshots

image
image
image
image

Checklist

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 4.7 and PHP 5.6.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

@google-cla google-cla bot added the cla: yes label Nov 13, 2020
felixarntz
felixarntz previously approved these changes Nov 13, 2020
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@aaemnnosttv One comment here, but nothing blocking.

Comment on lines 24 to 26
WID_SB: 1979909 # storybook.yml
WID_VRT: 2751946 # visual-regression.yml
WID_ZIPS: 1979910 # zips.yml
Copy link
Member

Choose a reason for hiding this comment

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

According to the docs, this also supports workflow names - wouldn't this be more intuitive to use?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looking at it again, that would be okay too. I originally read the docs for that to mean you could use the actual workflow name which I wouldn't want but it's the file name which is much more stable.

I guess it depends on how GH treats the workflow ID in relation to the file name. I would expect the ID to remain unchanged even if the workflow changed completely.

After taking a closer look at this, I found the API documentation for listing workflow runs which is what this uses (via octokit).

List all workflow runs for a workflow. You can also replace :workflow_id with :workflow_file_name. For example, you could use main.yml. You can use parameters to narrow the list of results. For more information about using parameters, see Parameters.

So that means we wouldn't need to use the full .github/workflows/zips.yml path which is what I was thinking it would require.

File names it is then? 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated to use filenames instead. It's much cleaner and doesn't require referencing something external to update. Also, the ability to use a filename instead is a feature provided by the underlying GitHub API (example) rather than the extension so this is much better I think 👍

@felixarntz felixarntz merged commit 07d95ed into develop Nov 13, 2020
@felixarntz felixarntz deleted the enhance/2027-auto-cancel-previous-workflows branch November 13, 2020 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants