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

feat: add gh action linter #68

Merged
merged 1 commit into from
Oct 19, 2024
Merged

feat: add gh action linter #68

merged 1 commit into from
Oct 19, 2024

Conversation

psadi
Copy link
Owner

@psadi psadi commented Oct 19, 2024

Summary by CodeRabbit

  • New Features

    • Introduced actionlint for improved linting in pre-commit hooks.
  • Bug Fixes

    • Updated the default Bitbucket host URL for better accessibility.
  • Chores

    • Enhanced Docker image tagging for clarity during release events.
    • Updated various dependencies to their latest versions for improved performance and security.

Copy link

coderabbitai bot commented Oct 19, 2024

Walkthrough

This pull request introduces several changes across multiple configuration files. The GitHub Actions workflow in .github/workflows/ci.yaml is updated to modify Docker image tagging based on release events. The .pre-commit-config.yaml file adds a new repository for actionlint. The config.ini file updates the bitbucket_host entry to a new URL. Additionally, the requirements.txt file reflects updates to several dependencies, and the tests/props.py file changes the default value of the bitbucket_host attribute in the Api class.

Changes

File Change Summary
.github/workflows/ci.yaml Updated Docker image tagging logic to use `github.event.release.tag_name
.pre-commit-config.yaml Added new repository for actionlint with version v1.7.3 and hook actionlint-system.
config.ini Changed bitbucket_host from https://bb.picolo.co.in to https://bitbucket.org.com.
requirements.txt Updated versions for anyio, coverage[toml], pyparsing, ruff, tox, and virtualenv.
tests/props.py Updated default bitbucket_host in Api class from https://bb.picolo.co.in to https://bitbucket.org.com.

Possibly related PRs

Poem

🐰 In the meadow where changes bloom,
Our workflows dance, dispelling gloom.
With tags that shine like stars at night,
Dependencies updated, all feels right.
A hop, a skip, let's celebrate,
For our code now dances, oh so great! 🌼


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

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: 2

🧹 Outside diff range and nitpick comments (2)
config.ini (1)

21-21: Fix typo in comment

There's a typo in the comment above the bitbucket_host line.

Apply this diff to fix the typo:

-; Dummu local hostname
+; Dummy local hostname
.github/workflows/ci.yaml (1)

162-162: Docker push strategy refined for releases

The updated push command correctly uses the release tag name, ensuring that only official releases are pushed to the registry. This aligns well with the release event condition.

However, consider the following suggestion:

To maintain a complete history of builds, consider pushing images for non-release builds as well. This can be achieved by using a similar conditional tag as in the build step. Here's a suggested improvement:

- name: Push Docker Image
  run: |
    docker push docker.io/psadi/bbcli:${{ github.event.release.tag_name || github.sha }}

This way, you'll push tagged images for releases and SHA-tagged images for other builds, providing a comprehensive build history in your registry.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between cc42273 and e0c0dde.

⛔ Files ignored due to path filters (1)
  • pdm.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • .github/workflows/ci.yaml (2 hunks)
  • .pre-commit-config.yaml (1 hunks)
  • config.ini (1 hunks)
  • requirements.txt (3 hunks)
  • tests/props.py (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • requirements.txt
🧰 Additional context used
🔇 Additional comments (4)
.pre-commit-config.yaml (1)

58-61: LGTM! Consider checking for the latest stable version.

The addition of actionlint to the pre-commit configuration is well-structured and aligns with the PR objective of adding a GitHub Action linter. This will help catch issues in GitHub Action workflows before they're committed.

To ensure we're using the latest stable version, let's check the actionlint releases:

If a newer stable version is available, consider updating to it for the latest features and bug fixes.

✅ Verification successful

Actionlint configuration is up to date.

The pre-commit configuration is using the latest stable version v1.7.3.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the latest stable version of actionlint
# Expect: The latest version number, which we can compare with v1.7.3

latest_version=$(gh release list --repo rhysd/actionlint --limit 1 | awk '{print $1}')
echo "Latest actionlint version: $latest_version"
echo "Current version in config: v1.7.3"

Length of output: 250

.github/workflows/ci.yaml (3)

141-141: Improved Docker image tagging strategy

The updated tagging strategy now uses the release tag name when available, falling back to the commit SHA. This change enhances version clarity for release builds while maintaining uniqueness for non-release builds.


146-146: Consistent image reference for vulnerability scanning

The Trivy vulnerability scanner now uses the same image reference as the build step. This consistency is crucial for ensuring that the exact image built is the one being scanned, maintaining the integrity of the security process.


Line range hint 141-162: Summary: Enhanced Docker workflow with improved tagging strategy

The changes in this file significantly improve the Docker image handling in the CI pipeline:

  1. The build step now uses a more robust tagging strategy, preferring release tags when available.
  2. The Trivy vulnerability scanner step has been updated to use the same image reference, ensuring consistency in security checks.
  3. The push step has been refined to handle release builds correctly.

These changes enhance version clarity, maintain security practices, and streamline the release process. Consider the suggestion for the push step to further improve the workflow for non-release builds.

Overall, these modifications represent a positive enhancement to the CI pipeline, particularly for Docker image management and security practices.

@@ -19,6 +19,6 @@

[auth]
; Dummu local hostname
bitbucket_host = https://bb.picolo.co.in
bitbucket_host = https://bitbucket.org.com
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

⚠️ Potential issue

Incorrect Bitbucket URL Still Present

The incorrect Bitbucket URL https://bitbucket.org.com is still found in config.ini. Please update it to https://bitbucket.org to ensure proper connectivity.

🔗 Analysis chain

Incorrect Bitbucket URL

The new Bitbucket URL https://bitbucket.org.com appears to be incorrect. The standard Bitbucket URL is https://bitbucket.org. Please verify and update the URL accordingly.

Apply this diff to fix the URL:

-bitbucket_host = https://bitbucket.org.com
+bitbucket_host = https://bitbucket.org

To ensure this change doesn't affect other parts of the codebase, please run the following script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for occurrences of the incorrect Bitbucket URL

# Test: Search for the incorrect URL. Expect: No results.
rg --type-add 'config:*.{ini,yaml,yml,json}' --type config 'https://bitbucket.org.com'

# Test: Search for the correct URL. Expect: At least one result in config.ini.
rg --type-add 'config:*.{ini,yaml,yml,json}' --type config 'https://bitbucket.org'

Length of output: 277

@@ -24,7 +24,7 @@

@dataclass(frozen=True, order=True)
class Api:
bitbucket_host: str = "https://bb.picolo.co.in"
bitbucket_host: str = "https://bitbucket.org.com"
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Incorrect Bitbucket host URL in configuration

The bitbucket_host is set to "https://bitbucket.org.com" in the following files, which is incorrect. It should be updated to "https://bitbucket.org":

  • config.ini: bitbucket_host = https://bitbucket.org.com
  • tests/props.py: bitbucket_host: str = "https://bitbucket.org.com"
-    bitbucket_host: str = "https://bitbucket.org.com"
+    bitbucket_host: str = "https://bitbucket.org"

- bitbucket_host = https://bitbucket.org.com
+ bitbucket_host = https://bitbucket.org
🔗 Analysis chain

Verify the updated Bitbucket host URL

The default value for bitbucket_host has been changed to "https://bitbucket.org.com", which appears to be incorrect. The standard Bitbucket URL is "https://bitbucket.org".

Please confirm if this change is intentional and consistent with other configuration updates (e.g., in config.ini). If not intended for testing purposes, consider updating to the correct URL:

-    bitbucket_host: str = "https://bitbucket.org.com"
+    bitbucket_host: str = "https://bitbucket.org"

To verify the consistency of this change across the codebase, you can run the following script:

This will help ensure that all references to the Bitbucket host are consistent and correct throughout the project.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for occurrences of Bitbucket URLs in the codebase

echo "Searching for Bitbucket URLs in the codebase:"
rg --type-add 'config:*.{ini,yaml,yml}' --type python --type config 'https?://(?:www\.)?bitbucket\.(?:org|com)'

echo "Searching for 'bitbucket_host' occurrences:"
rg --type-add 'config:*.{ini,yaml,yml}' --type python --type config 'bitbucket_host'

Length of output: 464


Script:

#!/bin/bash
# Description: Check for occurrences of Bitbucket URLs in the codebase

echo "Searching for Bitbucket URLs in the codebase:"
rg 'https?://(?:www\.)?bitbucket\.(?:org|com)' --glob '*.py' --glob '*.ini' --glob '*.yaml' --glob '*.yml'

echo "Searching for 'bitbucket_host' occurrences:"
rg 'bitbucket_host' --glob '*.py' --glob '*.ini' --glob '*.yaml' --glob '*.yml'

Length of output: 4958

@psadi psadi merged commit 5667c13 into main Oct 19, 2024
9 checks passed
@psadi psadi deleted the feature/hooks branch October 19, 2024 22:58
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