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

ollama-utils: add publish and cronjob workflows #1206

Merged
merged 14 commits into from
Feb 24, 2025

Conversation

ngxson
Copy link
Member

@ngxson ngxson commented Feb 16, 2025

In this PR:

  • Add cronjob to update template every monday at 7am GMT+0 (so I'll review it after having a 🥐)
  • Add workflow to publish the package to npm, need to check with @coyotte508 if we must do anything else to set it up
  • Add myself to CODEOWNERS of ollama-utils, not sure if @Vaibhavs10 wants to join?

For the auto-update workflow, here is a demo:

Copy link
Member

@Vaibhavs10 Vaibhavs10 left a comment

Choose a reason for hiding this comment

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

Conceptually LGTM!

console.log("Added templates for:");
console.log(addedModels.join("\n"));
console.log("Skipped these models due to error:");
console.log(skippedModelsDueToErr.join("\n"));

Choose a reason for hiding this comment

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

Can we use console.error() for better error differentiation? This would help separate errors from regular logs, making debugging and log filtering easier.

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'm not sure why stderr sometimes come out-of-order on github CI output, so I'm sticking with console.log for now

Copy link
Member

@coyotte508 coyotte508 left a comment

Choose a reason for hiding this comment

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

thanks

Copy link
Member

Choose a reason for hiding this comment

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

We need to be careful about injection when writing stuff to env in github actions - but I think it's fine in this case 👍 (no user-provided ref or branch name or file name in the vars)

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 acknowledge about this class of attack. In fact, that's why I always pass variable firstly via env and then access the environment variables in the code. So even if the user try to inject via ${{ steps.changes.outputs.NEW_BRANCH }} for example, it will still be contained inside a string.

In other words, a bad approach will be:

const newBranch = "${{ steps.changes.outputs.NEW_BRANCH }}";

Good approach:

const newBranch = process.env.NEW_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.

(Please note that the above is an example. Indeed, none of the variables in the script is user-controllable as you pointed out)

@ngxson ngxson merged commit 3409ee0 into huggingface:main Feb 24, 2025
4 checks passed
@ngxson
Copy link
Member Author

ngxson commented Feb 24, 2025

I'm getting this error:

Error: Unhandled error: HttpError: GitHub Actions is not permitted to create or approve pull requests.

https://github.com/huggingface/huggingface.js/actions/runs/13501236917/job/37719936942

@coyotte508 @julien-c Do you know how to enable this? Thanks!

@julien-c
Copy link
Member

julien-c commented Feb 25, 2025

@ngxson maybe ask in #infra channel

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.

5 participants