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

Update allowed branches in workflows for security fixes #640

Merged
merged 2 commits into from
Dec 14, 2024

Conversation

kotAPI
Copy link
Collaborator

@kotAPI kotAPI commented Dec 14, 2024

This PR allows workflows to run on security fixes branch and also runs chromatic only on the main repo and not the forks

Summary by CodeRabbit

  • New Features

    • Workflow triggers updated to include the security-fixes branch for building RAD UI and running tests.
    • Conditional execution added for Chromatic Deployment, restricting it to the main repository.
  • Bug Fixes

    • Enhanced workflow configurations to ensure proper execution on specified branches.
    • Upgraded action version for improved functionality in Chromatic Deployment.

Copy link
Contributor

coderabbitai bot commented Dec 14, 2024

Walkthrough

The pull request introduces modifications to three GitHub workflow configuration files. The .github/workflows/build-rad-ui.yml file now triggers on pull requests for both the main and security-fixes branches. The .github/workflows/chromatic.yml file adds a conditional clause to ensure the Chromatic deployment only runs for the rad-ui/ui repository. Lastly, the .github/workflows/test.yml file expands the push event triggers to include the security-fixes branch, while maintaining the existing configurations for jobs and steps.

Changes

File Change Summary
.github/workflows/build-rad-ui.yml Updated trigger to include security-fixes branch for pull requests.
.github/workflows/chromatic.yml Added conditional execution to restrict deployment to the rad-ui/ui repository; upgraded actions/checkout from v3 to v4.
.github/workflows/test.yml Updated push event trigger to include security-fixes branch.

Possibly related PRs

Poem

🐰 In the garden of code, we hop and play,
New branches bloom, brightening the way.
With Chromatic's watch, our colors align,
Security fixes, oh how they shine!
Together we build, with joy and delight,
In the world of GitHub, everything feels right! 🌼

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. This feature will be included in our Pro Plan when released.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dee38aa and 43217c3.

📒 Files selected for processing (1)
  • .github/workflows/chromatic.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/chromatic.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 generate docstrings to generate docstrings for this PR. (Experiment)
  • @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: 2

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

Line range hint 19-19: Update actions/checkout to v4

Other workflow files are using actions/checkout@v4, but this file uses v2. Consider updating for consistency and to leverage the latest features and security fixes.

-        uses: actions/checkout@v2
+        uses: actions/checkout@v4
.github/workflows/chromatic.yml (2)

Line range hint 31-31: Consider adding exit-zero-on-changes flag

The commented suggestion about --exit-zero-on-changes could be valuable to prevent workflow failures on visual changes, especially since this is running on the main branch only.

       with:
         projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
+        exitZeroOnChanges: true  # Prevents workflow failures on visual changes
🧰 Tools
🪛 actionlint (1.7.4)

17-17: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


13-14: Consider additional repository security checks

While the github.repository check is good, consider adding github.event.pull_request.head.repo.full_name checks for pull request events to further restrict workflow execution.

Example addition:

if: |
  github.repository == 'rad-ui/ui' &&
  (github.event_name != 'pull_request' ||
   github.event.pull_request.head.repo.full_name == 'rad-ui/ui')
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 918f111 and dee38aa.

📒 Files selected for processing (3)
  • .github/workflows/build-rad-ui.yml (1 hunks)
  • .github/workflows/chromatic.yml (1 hunks)
  • .github/workflows/test.yml (1 hunks)
🔇 Additional comments (2)
.github/workflows/test.yml (1)

5-5: LGTM! Branch configuration updated correctly

The addition of security-fixes to the push triggers aligns with the PR objectives.

.github/workflows/chromatic.yml (1)

13-14: LGTM! Repository restriction added correctly

The condition to run only on the main repository is properly implemented and aligns with the PR objectives.

Let's verify the repository name is correct:

✅ Verification successful

Let me verify the actual repository name by checking the repository configuration.


Let me check the content of other workflow files to ensure repository references are consistent.


Repository name verification successful, but action versions need standardization

The repository name rad-ui/ui is correctly referenced in the chromatic workflow and matches the repository configuration. However, I noticed inconsistent GitHub Action versions across workflows:

  • chromatic.yml: uses actions/checkout@v3
  • test.yml: uses actions/checkout@v2

Consider standardizing the action versions across workflows for better maintainability.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify repository name consistency
# Expect: Consistent repository name references

echo "Checking repository name references..."
rg -l "rad-ui/ui" .github/

Length of output: 145


Script:

#!/bin/bash
# Check repository name from git config and package.json
echo "Checking git remote origin..."
git config --get remote.origin.url

echo -e "\nChecking package.json..."
cat package.json | jq -r '.repository.url'

echo -e "\nChecking other potential repository references..."
rg -l "repository|repo" .github/ --type yaml

Length of output: 523


Script:

#!/bin/bash
# Check repository references in other workflow files
echo "Content of test.yml:"
cat .github/workflows/test.yml

echo -e "\nContent of dependabot.yml:"
cat .github/dependabot.yml

Length of output: 1396

.github/workflows/build-rad-ui.yml Show resolved Hide resolved
.github/workflows/chromatic.yml Outdated Show resolved Hide resolved
@kotAPI kotAPI merged commit fd873a9 into main Dec 14, 2024
6 checks passed
@kotAPI kotAPI deleted the pranay/run-ci-on-security-fixes branch December 14, 2024 02:27
@coderabbitai coderabbitai bot mentioned this pull request Dec 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
1 participant