Skip to content

Create cd.yml#8

Merged
canstralian merged 1 commit intomainfrom
canstralian-patch-1
Jan 8, 2025
Merged

Create cd.yml#8
canstralian merged 1 commit intomainfrom
canstralian-patch-1

Conversation

@canstralian
Copy link
Copy Markdown
Owner

@canstralian canstralian commented Jan 8, 2025

Summary by Sourcery

CI:

  • Add a CI workflow to deploy to Hugging Face on pushes to the main branch.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Jan 8, 2025

Reviewer's Guide by Sourcery

This pull request introduces a new continuous deployment (CD) workflow to automatically deploy to Hugging Face when changes are pushed to the main branch. The workflow sets up Python, installs dependencies, logs in to Hugging Face using a secret token, and includes placeholder commands for pushing models or datasets.

Sequence diagram for the CD workflow to Hugging Face

sequenceDiagram
    participant G as GitHub Actions
    participant P as Python Environment
    participant H as Hugging Face

    Note over G: Push to main branch
    G->>G: Checkout code
    G->>P: Set up Python 3.x
    G->>P: Install dependencies
    G->>P: Install huggingface_hub
    G->>H: Login with HF_TOKEN
    Note over G,H: Ready for model/dataset upload
Loading

File-Level Changes

Change Details Files
A new continuous deployment workflow was added.
  • Sets up Python and installs dependencies.
  • Logs in to Hugging Face using a secret token.
  • Includes placeholder commands for pushing models or datasets to Hugging Face.
  • Triggers the workflow on pushes to the main branch
.github/workflows/cd.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@canstralian canstralian merged commit 0ff0c88 into main Jan 8, 2025
Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @canstralian - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please replace the placeholder comments with the actual Hugging Face CLI commands for your specific model/dataset deployment
  • Consider pinning the Python version to a specific version (e.g., '3.9' or '3.10') instead of using '3.x' to ensure reproducibility
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟡 Security: 2 issues found
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .github/workflows/cd.yml

steps:
- name: Checkout code
uses: actions/checkout@v2
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚨 suggestion (security): Update checkout action to v3 for latest security features

Suggested change
uses: actions/checkout@v2
uses: actions/checkout@v3

Comment thread .github/workflows/cd.yml
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
pip install huggingface_hub
huggingface-cli login --token "${{ secrets.HF_TOKEN }}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚨 suggestion (security): Use environment variable for token instead of direct secrets reference

Consider using "$HF_TOKEN" since it's already set in the environment variables above. This maintains consistency and follows the principle of single configuration.

Suggested change
huggingface-cli login --token "${{ secrets.HF_TOKEN }}"
huggingface-cli login --token "$HF_TOKEN"

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.

1 participant