Skip to content

Conversation

@chaaz
Copy link
Owner

@chaaz chaaz commented Jan 26, 2023

This adds additional hooks to the runtime, which (just like the existing post_write hook) will not run on a dry run.

Hooks added:

  • pre_begin : runs before everything
  • pre_write : runs jjust before writing files
  • post_commit : runs after commits/push, but before tags
  • post_tag : runs after tagging
  • post_end : runs after everything

@chaaz chaaz self-assigned this Jan 26, 2023
Copy link
Contributor

@robko23 robko23 left a comment

Choose a reason for hiding this comment

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

Hi, this is very nice addition, however i have a few comments/questions about the number of hooks. What do you think?

Comment on lines +194 to +204
for proj_id in &self.proj_writes {
if let Some((root, hooks)) = args.hooks.get(proj_id) {
hooks.execute_pre_begin(root)?;
}
}

for proj_id in &self.proj_writes {
if let Some((root, hooks)) = args.hooks.get(proj_id) {
hooks.execute_pre_write(root)?;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need two hooks that are in the same place but different name?

Copy link
Owner Author

Choose a reason for hiding this comment

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

It does seem a little weird, but the idea is that the hooks are semantically different. Long term goal would be that the pre-begin hook runs on all projects on every release, whereas the pre-write hook runs only on projects that actually will write something. Also, if there later exists some hook-able action that occurs before write, the pre-write hook will come after that, but pre-begin will still come before it. Finally, because hooks are all run together, this will give a user to have some control over when their hooks will run in relation to each other.

Comment on lines +343 to +353
for proj_id in &self.write.proj_writes {
if let Some((root, hooks)) = args.hooks.get(proj_id) {
hooks.execute_post_tag(root)?;
}
}

for proj_id in &self.write.proj_writes {
if let Some((root, hooks)) = args.hooks.get(proj_id) {
hooks.execute_post_end(root)?;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

Copy link
Owner Author

Choose a reason for hiding this comment

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

(see above)

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.

3 participants