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

Add badge coverage #3

Closed
wants to merge 6 commits into from
Closed

Conversation

macalbert
Copy link
Owner

@macalbert macalbert commented Oct 6, 2024

Description

Add badge coverage in the README.md

Summary by CodeRabbit

  • New Features
    • Added coverage and conventional commits badges to the README for project health visibility.
    • Enhanced the workflow for code coverage, improving accuracy for Dependabot pull requests.
  • Documentation
    • Expanded prerequisites section to include AWS CLI installation and configuration instructions.
    • Clarified installation instructions for Envilder, with commands for both yarn and npm.
    • Retained usage section with examples for better user guidance.
  • Chores
    • Updated coverage reporting configuration to include a new JSON summary reporter.

Copy link

coderabbitai bot commented Oct 6, 2024

Walkthrough

The changes in this pull request involve modifications to the GitHub Actions workflow for code coverage, updates to the README.md file for improved documentation, and enhancements to the vitest.config.js file for coverage reporting. The workflow now includes stricter conditions for executing jobs related to Dependabot pull requests and adds a results badge step. The README.md has been enriched with badges, prerequisites, installation instructions, and usage examples. Lastly, the vitest.config.js file has been updated to include an additional coverage reporter.

Changes

File Change Summary
.github/workflows/coverage-report.yml Updated conditions for coverage job execution based on Dependabot and main branch checks. Added a results badge step.
README.md Added coverage and conventional commits badges, expanded prerequisites, clarified installation instructions, and retained usage section.
vitest.config.js Updated coverage reporter settings to include json-summary in addition to text and html.

Possibly related PRs

Suggested labels

github-actions

Poem

🐇 In the garden where the code does bloom,
A badge of coverage dispels the gloom.
With Dependabot checks, we’re swift and spry,
Clearer docs for all, oh my, oh my!
With each new change, our project will thrive,
Hopping along, keeping the code alive! 🌼


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

@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: 3

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

Line range hint 1-87: Overall workflow improvements with suggestion for optimization

The changes to this workflow file align well with the PR objectives of adding coverage badges. The modifications provide better control over when the coverage job runs, particularly for Dependabot PRs. The structure is logical and the new badge generation step enhances the visibility of code coverage.

To further optimize the workflow, consider the following suggestion:

  1. Combine the conditions for running the job into a single, comprehensive check at the job level. This would simplify the workflow and reduce redundancy. Here's an example:
jobs:
  build-coverage:
    # ... other job configurations ...
    if: |
      !github.event.pull_request.draft &&
      github.base_ref == 'refs/heads/main' &&
      github.actor != 'dependabot[bot]'
    steps:
      # ... steps without individual conditions ...
      - name: Publish Results Badge
        uses: wjervis7/[email protected]
        if: success() || failure()
        with:
          result-type: lines
          upload-badge: true

This change would maintain the same logic while simplifying the workflow structure.

README.md (4)

3-4: Great addition of badges!

The Coverage Status badge aligns perfectly with the PR objective. The Conventional Commits badge is a nice touch, providing additional information about the project's commit standards.

Consider adding an alt text to the badges for improved accessibility. For example:

[![Coverage Status](https://macalbert.github.io/envilder/badge.svg?branch=main)](https://macalbert.github.io/envilder/ "Coverage Status")
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org "Conventional Commits")

Line range hint 16-35: Excellent addition of prerequisites!

The new section provides crucial information for setting up and using Envilder. The AWS CLI installation and configuration instructions are clear and detailed.

Consider adding a note about the potential security implications of storing AWS credentials locally, and suggest using IAM roles for EC2 instances or AWS CLI named profiles for improved security practices.


Line range hint 37-45: Great update to installation instructions!

The addition of npm installation instructions alongside yarn improves accessibility for users with different package manager preferences.

Consider adding a note about the possibility of installing Envilder locally in a project, which might be useful for users who want to include it as a dev dependency. For example:

For local installation in a project:

```bash
npm install --save-dev envilder
# or
yarn add --dev envilder

---

Line range hint `83-96`: **Great addition of supplementary sections!**

The sections for running tests, license, and contributing provide important information for users and potential contributors. The test command aligns well with the coverage badge added earlier.


Consider adding a brief section on how to report issues or request features. For example:

```markdown
## 🐛 Reporting Issues

If you encounter any bugs or have feature requests, please file an issue on the [GitHub issues page](https://github.com/macalbert/envilder/issues).
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 07380a0 and 70b9482.

📒 Files selected for processing (3)
  • .github/workflows/coverage-report.yml (2 hunks)
  • README.md (3 hunks)
  • vitest.config.js (1 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/coverage-report.yml

33-33: if: condition "${{ !github.event.pull_request.draft }} && ${{ github.base_ref == 'refs/heads/main' }}" is always evaluated to true because extra characters are around ${{ }}

(if-cond)

🔇 Additional comments (4)
vitest.config.js (1)

8-8: LGTM! This change enables coverage badge generation.

The addition of 'json-summary' to the reporter array is a good change. This will generate a JSON summary of the coverage report, which is typically used to create coverage badges. This aligns well with the PR objective of adding a coverage badge to the README.md file.

.github/workflows/coverage-report.yml (1)

38-41: Improved Dependabot PR identification

The change to use a precise comparison "${{ github.actor }}" == "dependabot[bot]" instead of a wildcard check is a good improvement. This ensures that only pull requests from the specific Dependabot bot are recognized, enhancing the accuracy of the check.

README.md (2)

Line range hint 47-81: Clear and helpful usage instructions!

The usage and example sections provide clear instructions and a practical example of how to use Envilder. The sample output is particularly helpful for users to understand what to expect.


Line range hint 1-96: Overall excellent improvements to the README!

The changes significantly enhance the documentation quality, making it more comprehensive and user-friendly. The addition of the coverage badge meets the PR objective, and the extra improvements (Conventional Commits badge, expanded prerequisites, clearer installation instructions, etc.) add substantial value to the project documentation.

@@ -30,12 +30,12 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
if: ${{ !github.event.pull_request.draft }} && ${{ github.base_ref == 'refs/heads/main' }}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Simplify the job condition for better readability

The current condition is correct but can be simplified for better readability. The ${{ }} syntax is not needed for each individual condition within an if statement in GitHub Actions.

Consider simplifying the condition as follows:

if: !github.event.pull_request.draft && github.base_ref == 'refs/heads/main'

This change maintains the same logic while improving readability.

🧰 Tools
🪛 actionlint

33-33: if: condition "${{ !github.event.pull_request.draft }} && ${{ github.base_ref == 'refs/heads/main' }}" is always evaluated to true because extra characters are around ${{ }}

(if-cond)

Comment on lines 49 to 78
if: ${{ steps.dependabot-check.outputs.is_dependabot == 'false' }}
uses: actions/checkout@v4

- name: 🛠️ Setup Node.js with Cache
if: ${{ steps.dependabot-check.outputs.is_dependabot == 'false' }}
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "yarn"

- name: 📦 Install dependencies
if: ${{ steps.dependabot-check.outputs.is_dependabot == 'false' }}
run: yarn install

- name: 🔥 Run tests and collect coverage
if: ${{ steps.dependabot-check.outputs.is_dependabot == 'false' }}
run: yarn test

- name: Setup Pages
if: ${{ steps.dependabot-check.outputs.is_dependabot == 'false' }}
uses: actions/configure-pages@v5

- name: Upload artifact
if: ${{ steps.dependabot-check.outputs.is_dependabot == 'false' }}
uses: actions/upload-pages-artifact@v3
with:
path: "./coverage"

- name: Deploy to GitHub Pages
if: ${{ steps.dependabot-check.outputs.is_dependabot == 'false' }}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider using a job-level condition for Dependabot PRs

The addition of the condition if: ${{ steps.dependabot-check.outputs.is_dependabot == 'false' }} to multiple steps is a good way to prevent unnecessary execution for Dependabot PRs. However, this repetition might make the workflow less maintainable.

Consider moving this condition to the job level instead of repeating it for each step. You can do this by adding a job-level if condition and removing the individual step conditions:

jobs:
  build-coverage:
    # ... other job configurations ...
    if: ${{ !github.event.pull_request.draft && github.base_ref == 'refs/heads/main' && github.actor != 'dependabot[bot]' }}
    steps:
      # ... steps without individual conditions ...

This change would simplify the workflow and make it easier to maintain, while still achieving the same result of skipping the entire job for Dependabot PRs.

Comment on lines 82 to 87
- name: Publish Results Badge
uses: wjervis7/[email protected]
if: success() || failure()
with:
result-type: lines
upload-badge: ${{ github.base_ref == 'refs/heads/main' }}
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Security Concern with Third-Party Action

The wjervis7/[email protected] repository has low adoption metrics (4 stars and 0 forks), which may pose potential security and maintenance risks. It's recommended to verify the repository's reliability and consider using more widely-adopted actions to ensure the safety and integrity of your workflow.

🔗 Analysis chain

Approval for badge generation with security consideration

The addition of the "Publish Results Badge" step is a good enhancement to provide visibility into the code coverage. The configuration to run on both success and failure ensures the badge is always updated, and the conditional upload to the main branch is appropriate.

However, it's important to consider the security implications of using third-party actions. To ensure the safety and integrity of your workflow, please verify the following:

  1. Check the reputation and maintenance status of the wjervis7/vitest-badge-action repository.
  2. Review the action's source code for any potential security issues.
  3. Consider pinning the action to a specific commit hash instead of a version tag for improved security.

You can use the following command to check the action's repository:

This will provide information about the repository, including its stars, forks, and last update, which can help assess its reliability.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

gh repo view wjervis7/vitest-badge-action

Length of output: 4987


Script:

#!/bin/bash
# Get repository statistics: stars, forks, and last updated date
gh repo view wjervis7/vitest-badge-action --json stargazersCount,forksCount,updatedAt

Length of output: 1220


Script:

#!/bin/bash
# Get repository statistics: stargazerCount, forksCount, and last updated date
gh repo view wjervis7/vitest-badge-action --json stargazerCount,forksCount,updatedAt

Length of output: 1214


Script:

#!/bin/bash
# Get repository statistics: stargazerCount, forkCount, and last updated date
gh repo view wjervis7/vitest-badge-action --json stargazerCount,forkCount,updatedAt

Length of output: 155

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

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

33-78: Streamline workflow by consolidating conditions

The changes to this workflow aim to run the coverage job only for non-draft PRs targeting the main branch, excluding Dependabot PRs. While the logic is correct, the implementation is verbose and potentially error-prone due to repetition.

To improve the workflow:

  1. Consolidate all conditions at the job level:
    if: ${{ !github.event.pull_request.draft && github.base_ref == 'main' && github.actor != 'dependabot[bot]' }}
  2. Remove all individual step conditions.

This change will significantly simplify the workflow, improve readability, and reduce the risk of inconsistencies while maintaining the same functionality.

🧰 Tools
🪛 actionlint

33-33: could not parse as YAML: yaml: line 33: did not find expected alphabetic or numeric character

(syntax-check)

🪛 yamllint

[error] 33-33: syntax error: expected alphabetic or numeric character, but found '&'

(syntax)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 70b9482 and 4c782bf.

📒 Files selected for processing (1)
  • .github/workflows/coverage-report.yml (1 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/coverage-report.yml

33-33: could not parse as YAML: yaml: line 33: did not find expected alphabetic or numeric character

(syntax-check)

🪛 yamllint
.github/workflows/coverage-report.yml

[error] 33-33: syntax error: expected alphabetic or numeric character, but found '&'

(syntax)

🔇 Additional comments (2)
.github/workflows/coverage-report.yml (2)

38-41: Improved Dependabot check

The modification to directly check for "dependabot[bot]" is a good improvement. It's more precise and secure than using a wildcard check.


68-68: Apply previous suggestion to remaining steps

The conditions added to the Setup Pages, Upload artifact, and Deploy to GitHub Pages steps have the same repetition and redundancy issues as mentioned in the previous comment.

The suggestion to move the Dependabot check to the job level and remove individual step conditions applies here as well. This change will simplify these steps and improve the overall workflow maintainability.

Also applies to: 72-72, 78-78

@@ -30,44 +30,51 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
if: !github.event.pull_request.draft && github.base_ref == 'refs/heads/main'
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix syntax error in job condition

The condition for the job is logically correct, but there's a syntax error. In GitHub Actions, expressions in if statements should be wrapped in ${{ }}. Also, for better readability, we can simplify the condition.

Please update the condition as follows:

if: ${{ !github.event.pull_request.draft && github.base_ref == 'main' }}

This change will fix the syntax error and improve readability. Note that I've also simplified 'refs/heads/main' to just 'main', as GitHub Actions automatically expands this when comparing branch names.

🧰 Tools
🪛 actionlint

33-33: could not parse as YAML: yaml: line 33: did not find expected alphabetic or numeric character

(syntax-check)

🪛 yamllint

[error] 33-33: syntax error: expected alphabetic or numeric character, but found '&'

(syntax)

echo "is_dependabot=true" >> "$GITHUB_OUTPUT"
else
echo "is_dependabot=false" >> "$GITHUB_OUTPUT"
fi

- name: Check if the workflow should run
if: ${{ steps.dependabot-check.outputs.is_dependabot == 'false' }}
if: steps.dependabot-check.outputs.is_dependabot == 'false' && github.base_ref == 'refs/heads/main'
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Simplify condition and consider redundancy

The condition is correct but can be simplified:

  1. 'refs/heads/main' can be shortened to 'main'.
  2. The check for the base ref is redundant with the job-level condition.

Consider updating the condition to:

if: steps.dependabot-check.outputs.is_dependabot == 'false'

This simplification maintains the necessary Dependabot check while relying on the job-level condition for the base ref check.

run: echo "The workflow is allowed to run for this PR"

- name: 🧲 Checkout
if: steps.dependabot-check.outputs.is_dependabot == 'false' && github.base_ref == 'refs/heads/main'
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Simplify and reduce repetitive conditions

The conditions added to the Checkout, Setup Node.js, Install dependencies, and Run tests steps are correct but repetitive. They also include a redundant check for the base ref, which is already handled at the job level.

To improve maintainability and readability, consider:

  1. Removing the base ref check from these conditions.
  2. Moving the Dependabot check to the job level.

Update the job-level condition:

if: ${{ !github.event.pull_request.draft && github.base_ref == 'main' && github.actor != 'dependabot[bot]' }}

Then remove the individual step conditions. This change will simplify the workflow while maintaining the same logic.

Also applies to: 53-53, 60-60, 64-64

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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4c782bf and 153e0f2.

📒 Files selected for processing (1)
  • .github/workflows/coverage-report.yml (1 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/coverage-report.yml

45-45: if: condition "${{ steps.dependabot-check.outputs.is_dependabot == 'false' }} && ${{ github.base_ref == 'refs/heads/main' }}" is always evaluated to true because extra characters are around ${{ }}

(if-cond)


49-49: if: condition "${{ steps.dependabot-check.outputs.is_dependabot == 'false' }} && ${{ github.base_ref == 'refs/heads/main' }}" is always evaluated to true because extra characters are around ${{ }}

(if-cond)


53-53: if: condition "${{ steps.dependabot-check.outputs.is_dependabot == 'false' }} && ${{ github.base_ref == 'refs/heads/main' }}" is always evaluated to true because extra characters are around ${{ }}

(if-cond)


60-60: if: condition "${{ steps.dependabot-check.outputs.is_dependabot == 'false' }} && ${{ github.base_ref == 'refs/heads/main' }}" is always evaluated to true because extra characters are around ${{ }}

(if-cond)


64-64: if: condition "${{ steps.dependabot-check.outputs.is_dependabot == 'false' }} && ${{ github.base_ref == 'refs/heads/main' }}" is always evaluated to true because extra characters are around ${{ }}

(if-cond)


68-68: if: condition "${{ steps.dependabot-check.outputs.is_dependabot == 'false' }} && ${{ github.base_ref == 'refs/heads/main' }}" is always evaluated to true because extra characters are around ${{ }}

(if-cond)


72-72: if: condition "${{ steps.dependabot-check.outputs.is_dependabot == 'false' }} && ${{ github.base_ref == 'refs/heads/main' }}" is always evaluated to true because extra characters are around ${{ }}

(if-cond)


78-78: if: condition "${{ steps.dependabot-check.outputs.is_dependabot == 'false' }} && ${{ github.base_ref == 'refs/heads/main' }}" is always evaluated to true because extra characters are around ${{ }}

(if-cond)

🔇 Additional comments (1)
.github/workflows/coverage-report.yml (1)

38-41: Approve Dependabot check implementation

The implementation of the Dependabot check is correct and efficient. It uses a direct comparison to "dependabot[bot]" and sets an output variable for use in subsequent steps. This approach is more precise than using a wildcard check.

@@ -30,44 +30,51 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
if: ${{ !github.event.pull_request.draft && github.base_ref == 'refs/heads/main' }}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Simplify the job-level condition for improved readability

The current condition is correct, but it can be simplified for better readability. Consider updating it as follows:

if: ${{ !github.event.pull_request.draft && github.base_ref == 'main' }}

This change maintains the same logic while improving readability. Note that 'refs/heads/main' can be simplified to just 'main' as GitHub Actions automatically expands this when comparing branch names.

Comment on lines +45 to 46
if: ${{ steps.dependabot-check.outputs.is_dependabot == 'false' }} && ${{ github.base_ref == 'refs/heads/main' }}
run: echo "The workflow is allowed to run for this PR"
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Simplify condition and remove redundancy

The current condition is logically correct but can be simplified:

  1. Remove the redundant base ref check, as it's already handled at the job level.
  2. Simplify the syntax by removing extra ${{ }} wrappers.

Update the condition as follows:

- name: Check if the workflow should run
  if: steps.dependabot-check.outputs.is_dependabot == 'false'
  run: echo "The workflow is allowed to run for this PR"

This change maintains the necessary Dependabot check while reducing redundancy and improving readability.

🧰 Tools
🪛 actionlint

45-45: if: condition "${{ steps.dependabot-check.outputs.is_dependabot == 'false' }} && ${{ github.base_ref == 'refs/heads/main' }}" is always evaluated to true because extra characters are around ${{ }}

(if-cond)

Comment on lines +49 to 50
if: ${{ steps.dependabot-check.outputs.is_dependabot == 'false' }} && ${{ github.base_ref == 'refs/heads/main' }}
uses: actions/checkout@v4
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Refactor workflow to reduce repetition and improve maintainability

The current implementation has repetitive conditions across multiple steps, which can make the workflow harder to maintain. Consider the following improvements:

  1. Move the Dependabot check to the job level.
  2. Remove the redundant base ref checks from individual steps.
  3. Simplify the syntax by removing extra ${{ }} wrappers.

Update the job-level condition:

if: ${{ !github.event.pull_request.draft && github.base_ref == 'main' && github.actor != 'dependabot[bot]' }}

Then remove the individual step conditions. This change will significantly simplify the workflow while maintaining the same logic. For example:

- name: 🧲 Checkout
  uses: actions/checkout@v4

- name: 🛠️ Setup Node.js with Cache
  uses: actions/setup-node@v4
  with:
    node-version: "20.x"
    cache: "yarn"

# ... (other steps without individual conditions)

This refactoring will make the workflow more concise, easier to read, and simpler to maintain.

Also applies to: 53-54, 60-61, 64-65, 68-69, 72-73, 78-79

🧰 Tools
🪛 actionlint

49-49: if: condition "${{ steps.dependabot-check.outputs.is_dependabot == 'false' }} && ${{ github.base_ref == 'refs/heads/main' }}" is always evaluated to true because extra characters are around ${{ }}

(if-cond)

@macalbert macalbert marked this pull request as draft October 16, 2024 18:30
@macalbert macalbert closed this Oct 16, 2024
@macalbert macalbert deleted the macalbert/apply-review-comments branch October 16, 2024 18:31
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