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

Added trigger dependent repo update workflow #8389

Merged
merged 3 commits into from
Sep 10, 2024

Conversation

azhavoro
Copy link
Contributor

@azhavoro azhavoro commented Sep 2, 2024

Motivation and context

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)
  • I have increased versions of npm packages if it is necessary
    (cvat-canvas,
    cvat-core,
    cvat-data and
    cvat-ui)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

Summary by CodeRabbit

  • New Features
    • Introduced a new GitHub Actions workflow to automate updates in dependent repositories based on changes in the primary repository.
    • The workflow can be triggered manually or on pushes to the master branch, enhancing integration and communication between repositories.

Copy link
Contributor

coderabbitai bot commented Sep 2, 2024

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

A new GitHub Actions workflow named "Trigger Dependent Repo Update Workflow" has been created. It is designed to be triggered manually or upon pushes to the master branch. The workflow generates an authentication token and uses it to initiate a repository dispatch event to a dependent repository, facilitating automated updates based on changes in the primary repository.

Changes

Files Change Summary
.github/workflows/trigger-dependent-repo-update.yml New workflow created to trigger updates in dependent repositories upon specific events.

Poem

🐰 In the garden where code does bloom,
A workflow dances, dispelling gloom.
With tokens in hand, it sends a cheer,
To distant repos, far yet near.
Updates flow like springtime rain,
Hopping along, no need for pain! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between cb6c50f and 734b95c.

Files selected for processing (1)
  • .github/workflows/trigger-dependent-repo-update.yml (1 hunks)
Additional comments not posted (4)
.github/workflows/trigger-dependent-repo-update.yml (4)

1-7: LGTM: Workflow name and triggers are well-defined.

The workflow name is descriptive, and the triggers (manual and push to master) are appropriate for the intended purpose of updating dependent repositories.


8-11: LGTM: Job setup is appropriate.

The job named "trigger" running on ubuntu-latest is a standard and suitable setup for this workflow.


1-26: Overall, the workflow is well-designed and achieves its purpose.

This new workflow effectively triggers updates in dependent repositories when changes are pushed to the master branch or manually initiated. It uses secure token generation and provides relevant metadata to the dependent repository.

A few points to consider:

  1. Ensure all required secrets are properly set in the repository settings.
  2. Consider making the organization name configurable for improved flexibility.

These minor adjustments will enhance the robustness and reusability of the workflow.


12-19: LGTM: Secure token generation using GitHub App authentication.

The token generation step is well-implemented using the GitHub App authentication method.

Please ensure that the following secrets are properly set in the repository settings:

  • CVAT_BOT_APP_ID
  • CVAT_BOT_PRIVATE_KEY
  • CVAT_DEPENDENT_REPO

You can verify the existence of these secrets by running the following script:

Comment on lines 20 to 26
- name: Trigger repository dispatch
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ steps.gen-token.outputs.token }}
repository: cvat-ai/${{ secrets.CVAT_DEPENDENT_REPO }}
event-type: dependency_updated
client-payload: '{"triggered_by": "${{ github.repository }}", "commit_sha": "${{ github.sha }}", "branch": "${{ github.ref }}"}'
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM with suggestion: Repository dispatch step is well-implemented.

The repository dispatch step correctly triggers an update in the dependent repository with relevant metadata.

Consider making the organization name configurable instead of hardcoding 'cvat-ai'. This would make the workflow more flexible and reusable. You can achieve this by using a secret or an environment variable. Here's a suggested change:

- repository: cvat-ai/${{ secrets.CVAT_DEPENDENT_REPO }}
+ repository: ${{ secrets.CVAT_ORGANIZATION }}/${{ secrets.CVAT_DEPENDENT_REPO }}

Don't forget to add the CVAT_ORGANIZATION secret to your repository settings if you implement this change.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Trigger repository dispatch
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ steps.gen-token.outputs.token }}
repository: cvat-ai/${{ secrets.CVAT_DEPENDENT_REPO }}
event-type: dependency_updated
client-payload: '{"triggered_by": "${{ github.repository }}", "commit_sha": "${{ github.sha }}", "branch": "${{ github.ref }}"}'
- name: Trigger repository dispatch
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ steps.gen-token.outputs.token }}
repository: ${{ secrets.CVAT_ORGANIZATION }}/${{ secrets.CVAT_DEPENDENT_REPO }}
event-type: dependency_updated
client-payload: '{"triggered_by": "${{ github.repository }}", "commit_sha": "${{ github.sha }}", "branch": "${{ github.ref }}"}'

@codecov-commenter
Copy link

codecov-commenter commented Sep 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.60%. Comparing base (cb6c50f) to head (8f271b3).
Report is 15 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8389      +/-   ##
===========================================
+ Coverage    83.56%   83.60%   +0.03%     
===========================================
  Files          396      397       +1     
  Lines        41830    41906      +76     
  Branches      3881     3883       +2     
===========================================
+ Hits         34955    35034      +79     
+ Misses        6875     6872       -3     
Components Coverage Δ
cvat-ui 79.56% <ø> (+0.03%) ⬆️
cvat-server 87.18% <ø> (+0.02%) ⬆️

Copy link

@SpecLad SpecLad merged commit ac7f4ab into develop Sep 10, 2024
34 checks passed
@SpecLad SpecLad deleted the az/trigger_dependent_repo_wf branch September 10, 2024 11:25
bschultz96 pushed a commit to bschultz96/cvat that referenced this pull request Sep 12, 2024
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