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

Allow to trigger github workflow manually #68

Merged
merged 2 commits into from
Nov 14, 2024

Conversation

barakb
Copy link
Contributor

@barakb barakb commented Nov 14, 2024

Summary by CodeRabbit

  • New Features

    • Added manual execution triggers for workflows in the coverage, main, and pull request checks configurations, enhancing flexibility for users to run workflows on demand.
  • Bug Fixes

    • No bug fixes were made in this release.
  • Documentation

    • No documentation updates were included in this release.

Copy link

coderabbitai bot commented Nov 14, 2024

Walkthrough

The pull request introduces updates to three GitHub workflow configuration files: .github/workflows/coverage.yml, .github/workflows/main.yml, and .github/workflows/pr-checks.yml. Each file has been modified to include a new trigger, workflow_dispatch, which allows users to manually initiate the workflows in addition to the existing automatic triggers. No changes were made to the jobs, steps, or configurations within these workflows.

Changes

File Path Change Summary
.github/workflows/coverage.yml Added workflow_dispatch event for manual execution.
.github/workflows/main.yml Added workflow_dispatch event for manual execution.
.github/workflows/pr-checks.yml Added workflow_dispatch event for manual execution.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Workflow
    User->>Workflow: Trigger workflow (manual)
    Workflow->>Workflow: Execute jobs
    Workflow->>User: Return results
Loading

🐇 "In the land of code, where workflows thrive,
A new trigger's born, making tasks come alive.
With a hop and a skip, we can run on demand,
Manual execution, just a click of the hand!
So gather your code, let the checks begin,
For every new change, let the fun times spin!" 🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between e1a8243 and 6e56d1c.

📒 Files selected for processing (1)
  • .github/workflows/coverage.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/coverage.yml

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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

codecov bot commented Nov 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.93%. Comparing base (3a81181) to head (6e56d1c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #68   +/-   ##
=======================================
  Coverage   84.93%   84.93%           
=======================================
  Files          28       28           
  Lines        3909     3909           
  Branches     3909     3909           
=======================================
  Hits         3320     3320           
  Misses        399      399           
  Partials      190      190           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@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

🧹 Outside diff range and nitpick comments (1)
.github/workflows/coverage.yml (1)

12-12: LGTM! Consider documenting trigger permissions.

The addition of workflow_dispatch trigger is well-placed and follows GitHub Actions best practices. This change successfully enables manual workflow execution while maintaining compatibility with existing automated triggers.

Consider documenting who can manually trigger this workflow in the repository's documentation. By default, users with write access to the repository can trigger manual workflows.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 36974a0 and e1a8243.

📒 Files selected for processing (3)
  • .github/workflows/coverage.yml (1 hunks)
  • .github/workflows/main.yml (1 hunks)
  • .github/workflows/pr-checks.yml (1 hunks)
🔇 Additional comments (2)
.github/workflows/pr-checks.yml (1)

6-6: LGTM! The workflow_dispatch trigger is correctly configured.

The addition of the workflow_dispatch trigger allows for manual execution of the workflow while maintaining the existing pull request trigger functionality.

.github/workflows/main.yml (1)

11-11: LGTM! Manual trigger capability added correctly.

The addition of workflow_dispatch event is properly configured, allowing manual execution of the workflow while preserving existing automated triggers.

Let's verify the consistency of manual triggers across all workflow files:

✅ Verification successful

Manual trigger capability consistently added across all workflow files

The verification confirms that workflow_dispatch trigger has been properly added to all GitHub workflow files:

  • .github/workflows/coverage.yml
  • .github/workflows/main.yml
  • .github/workflows/pr-checks.yml
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that workflow_dispatch is added consistently across workflow files
# Expected: All workflow files mentioned in the summary should have workflow_dispatch trigger

# Check all workflow files for workflow_dispatch trigger
echo "Checking workflow files for manual trigger configuration..."
for file in .github/workflows/{coverage,main,pr-checks}.yml; do
    echo "=== $file ==="
    rg -A 2 "on:|workflow_dispatch" "$file"
done

Length of output: 1947

@@ -3,6 +3,7 @@ name: Mandatory Pull Request Checks
on:
pull_request:
branches: [ "main" ]
workflow_dispatch:
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Add permissions configuration to pr-checks.yml workflow

The workflow file pr-checks.yml lacks a permissions configuration block, unlike main.yml which properly defines its permissions. Add a minimal permissions block to explicitly restrict the workflow's access:

permissions: read-all
  • Add this block right after the on: section in .github/workflows/pr-checks.yml

This ensures the workflow only has read access by default, which is sufficient for PR checks like building, testing, and linting. The workflow_dispatch trigger will inherit these permissions, preventing potential misuse of elevated privileges during manual runs.

🔗 Analysis chain

Consider configuring permissions for manual workflow triggers.

To prevent potential abuse of CI resources, ensure that appropriate permissions are configured for who can manually trigger this workflow.

Let's check the repository's workflow permissions:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check workflow permissions configuration in the repository

# Check for workflow permissions in repository settings
gh api repos/{owner}/{repo}/actions/permissions

# Check for environment protection rules that might affect workflow execution
gh api repos/{owner}/{repo}/environments

# Look for any existing permissions configurations in workflow files
rg -l "permissions:" .github/workflows/

Length of output: 438


Script:

#!/bin/bash
# Let's check the content of both workflow files to see their permissions configuration
cat .github/workflows/main.yml
cat .github/workflows/pr-checks.yml

Length of output: 2758

@barakb barakb requested a review from AviAvni November 14, 2024 11:44
@barakb barakb merged commit 337bb5e into main Nov 14, 2024
9 checks passed
@barakb barakb deleted the allow_to_trigger_github_workflow_manually branch November 14, 2024 15:06
@github-actions github-actions bot mentioned this pull request Nov 14, 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.

1 participant