8000 feat(programmatic-interface): export a function to enable running an octoherd script against a repository list by travi · Pull Request #220 · octoherd/cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(programmatic-interface): export a function to enable running an octoherd script against a repository list #220

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

Merged
merged 3 commits into from
May 5, 2025

Conversation

travi
Copy link
Member
@travi travi commented May 1, 2025

for #219

@@ -2,6 +2,7 @@ import enquirer from "enquirer";
import chalk from "chalk";

import { resolveRepositories } from "./resolve-repositories.js";
import { runScriptAgainstRepositories as runScriptAgainstResolvedRepositories } from "./run-script-against-resolved-repositories.js";
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 dont love this naming, but starting with something that i figured we could discuss.

the extracted bit seems more like the bit that would be appropriate to refer to as runScriptAgainstRepositories. if you agree, this would also be the name of the new public export, so consider that while deciding if this name feels right.

without further changes, that name would obviously conflict with the current name of the caller of the extraction. do you have thoughts on an alternative name for the caller based on the other responsibilities?

Copy link
Member

Choose a reason for hiding this comment

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

I agree that runScriptAgainstRepositories is the right name for the exported method. Not sure why I used against at the time, I think it's a direct translation of how you would say it in German. If you think there is a better term in English we can use something else, now is the time.

If you like we can rename the existing runScriptAgainstRepositories() method and file name to something like loadRepositoriesAndRunScript, to express that the method loads the repositories and then passes runs the script against each repository?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure why I used against at the time, I think it's a direct translation of how you would say it in German. If you think there is a better term in English we can use something else, now is the time.

i think "against" is appropriate here, so no concerns with that. just trying to be clear with the separate parts as we tease things apart

If you like we can rename the existing runScriptAgainstRepositories() method and file name to something like loadRepositoriesAndRunScript, to express that the method loads the repositories and then passes runs the script against each repository?

i like that. that better captures the multiple steps. it looked like some of the repo resolution logic was added later, so the original name probably made sense at the time, but i think this works better for what it has grown to

);

try {
if (octokit.log.setContext) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Logging for Octoherd is relevant for reports, ...

I think for the programmatic interface we might not need to take any of this into account. I think just using a standard @octokit/core constructor should work, but users of the programmatic interface can pass in their own customized instance of course, e.g. if they want throttling or retries.

i made this conditional on being present, so the reporting behavior is still possible when the octoherd instance of octokit is used. i agree that targeting use with any instance with a base of @octokit/core would be ideal for general usage. open to alternative thoughts on approach here if you have any.

@travi
Copy link
Member Author
travi commented May 5, 2025

i also realized that i targeted an alpha release with this PR, but the alpha branch doesnt currently cause the release workflow to trigger. would you prefer i target a beta release instead, or is it worth adding alpha as a branch that would trigger the release workflow?

@travi travi force-pushed the programmatic-interface branch from 3c7fef4 to 574989f Compare May 5, 2025 15:17
@travi travi marked this pull request as ready for review May 5, 2025 15:21
@gr2m
Copy link
Member
gr2m commented May 5, 2025

would you prefer i target a beta release instead

I'd say a beta will suffice but either works for me

Copy link
Member
@gr2m gr2m left a comment

Choose a reason for hiding this comment

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

We intentionally don't document it in the README yet, as we might change the API in future, right?

@travi
Copy link
Member Author
travi commented May 5, 2025

We intentionally don't document it in the README yet, as we might change the API in future, right?

yeah, i meant to call that out again in this thread, but forgot. thanks for confirming

after we merge this, i'll open a draft PR to promote beta to stable and will capture pending items there

@travi travi deleted the branch octoherd:beta May 5, 2025 19:35
@travi travi closed this May 5, 2025
@travi travi reopened this May 5, 2025
@travi travi changed the base branch from alpha to beta May 5, 2025 19:36
@travi
Copy link
Member Author
travi commented May 5, 2025

I'd say a beta will suffice

updated (after realizing that deleting the target branch before changing in the PR causes issues. resolved now though)

@travi travi changed the title refactor(programmatic-interface): extract logic to run script against a provided list of repositories feat(programmatic-interface): export a function to enable running an octoherd script against a repository list May 5, 2025
@travi travi merged commit ee6ea64 into octoherd:beta May 5, 2025
3 checks passed
@travi travi deleted the programmatic-interface branch May 5, 2025 19:40
Copy link
github-actions bot commented May 5, 2025

🎉 This PR is included in version 5.1.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0