Skip to content

Conversation

@thedeeppp
Copy link

@thedeeppp thedeeppp commented Mar 4, 2025

Description

  1. added featured label (attached image for reference)
    {F4E052AB-0232-4F7F-95BF-372EDA76532E}

  2. Integrated workflow with slack channel. have made slack-notifications.yml file inside .github/workflows (webhook URL might need to be changed)

Related issue(s)

solves #3778

Summary by CodeRabbit

  • New Features
    • Introduced automated notifications on major updates.
    • Enhanced blog posts by displaying a prominent “Featured” label for highlighted content.
  • Bug Fixes
    • Corrected typographical errors for improved textual accuracy and consistency.
  • Chores
    • Improved accuracy of date calculations for better functionality.
    • Enhanced test reliability with additional cleanup logic.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 4, 2025

Walkthrough

This update introduces a new GitHub Actions workflow that sends a Slack notification when commits are pushed to the master branch. Additionally, the BlogPostItem component has been updated to conditionally display a "Featured" label based on the post data, along with a minor styling adjustment. Typographical corrections were made in the markdown about page to enhance textual accuracy.

Changes

File(s) Change Summary
.github/workflows/slack-notifications.yml Added a new workflow triggered on master branch pushes that runs a job using Ubuntu, sending Slack notifications via the rtCamp/action-slack-notify@v2.1.0 action.
components/navigation/BlogPostItem.tsx Modified the component to extract a featured property; conditionally renders a "Featured" label and updates the <li> element class with relative.
markdown/about/index.md Corrected typographical errors and formatting issues in company descriptions and YouTube Channel link.
scripts/dashboard/build-dashboard.js Improved the monthsSince function to accurately calculate the number of months between dates by considering year and month differences.
tests/build-pages.test.js Added cleanup logic to ensure a clean state for the test case by removing pre-existing directories before and after the test execution.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant GH as GitHub Actions
    participant Slack as Slack API

    Dev->>GH: Push commit to master branch
    GH->>GH: Trigger slack-notifications workflow
    GH->>Slack: Send notification via Slack action
    Slack-->>GH: Acknowledge notification
Loading

Possibly related PRs

Suggested labels

ready-to-merge, autoapproved, bounty

Suggested reviewers

  • derberg
  • magicmatatjahu
  • devilkiller-ag
  • akshatnema
  • sambhavgupta0705
  • anshgoyalevil
  • Mayaleeeee
  • quetzalliwrites

Poem

I hopped through the code with glee,
A Slack alert sprang forth to see.
On master, each push rings a bell,
And featured posts shine oh so well!
A rabbit's cheer, coding magic in spree!

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
  • @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.

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.

@asyncapi-bot
Copy link
Contributor

asyncapi-bot commented Mar 4, 2025

We require all PRs to follow Conventional Commits specification.
More details 👇🏼

 No release type found in pull request title "solves #3778, add featured label and integrated workflow with slack". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@netlify
Copy link

netlify bot commented Mar 4, 2025

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit b8ba95d
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/67c7fdd32d3fce000850ed00
😎 Deploy Preview https://deploy-preview-3786--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@thedeeppp
Copy link
Author

please let me know if further changes needed

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

🧹 Nitpick comments (3)
.github/workflows/slack-notifications.yml (2)

15-18: Enhanced notification message would provide better context.

The current message is very generic. Consider enhancing it with more context about the commit that triggered the workflow.

- SLACK_MESSAGE: 'A workflow has been triggered on the master branch.' 
+ SLACK_MESSAGE: 'New changes pushed to master branch by ${{ github.actor }}. Commit message: "${{ github.event.head_commit.message }}"'
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 18-18: no new line character at the end of file

(new-line-at-end-of-file)


[error] 18-18: trailing spaces

(trailing-spaces)


18-18: Fix YAML formatting issues.

The file has YAML linting errors including trailing spaces on line 18 and missing newline at the end of the file.

- SLACK_MESSAGE: 'A workflow has been triggered on the master branch.' 
+ SLACK_MESSAGE: 'A workflow has been triggered on the master branch.'
+
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 18-18: no new line character at the end of file

(new-line-at-end-of-file)


[error] 18-18: trailing spaces

(trailing-spaces)

components/navigation/BlogPostItem.tsx (1)

67-71: Use consistent BEM naming for the "Featured" label classes.

For better maintainability and consistency with component styling, consider using BEM naming for the featured label classes, and potentially extracting the styles to a dedicated class.

- <span className='featured-label bg-yellow-100 text-yellow-800 font-bold px-2 py-1 rounded-md absolute top-2 left-2 z-10'>
+ <span className='blog-post-item__featured-label bg-yellow-100 text-yellow-800 font-bold px-2 py-1 rounded-md absolute top-2 left-2 z-10'>
🧰 Tools
🪛 ESLint

[error] 68-68: Replace "featured-label·bg-yellow-100·text-yellow-800·font-bold·px-2·py-1·rounded-md·absolute·top-2·left-2·z-10" with 'featured-label·bg-yellow-100·text-yellow-800·font-bold·px-2·py-1·rounded-md·absolute·top-2·left-2·z-10'

(prettier/prettier)


[error] 68-68: Unexpected usage of doublequote.

(jsx-quotes)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9687130 and 908a9c3.

📒 Files selected for processing (2)
  • .github/workflows/slack-notifications.yml (1 hunks)
  • components/navigation/BlogPostItem.tsx (3 hunks)
🧰 Additional context used
🪛 ESLint
components/navigation/BlogPostItem.tsx

[error] 38-38: 'isFeatured' is assigned a value but never used.

(unused-imports/no-unused-vars)


[error] 38-38: 'isFeatured' is assigned a value but never used.

(no-unused-vars)


[error] 68-68: Replace "featured-label·bg-yellow-100·text-yellow-800·font-bold·px-2·py-1·rounded-md·absolute·top-2·left-2·z-10" with 'featured-label·bg-yellow-100·text-yellow-800·font-bold·px-2·py-1·rounded-md·absolute·top-2·left-2·z-10'

(prettier/prettier)


[error] 68-68: Unexpected usage of doublequote.

(jsx-quotes)

🪛 YAMLlint (1.35.1)
.github/workflows/slack-notifications.yml

[error] 1-1: wrong new line character: expected \n

(new-lines)


[error] 18-18: no new line character at the end of file

(new-line-at-end-of-file)


[error] 18-18: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 180000ms (4)
  • GitHub Check: Redirect rules - asyncapi-website
  • GitHub Check: Header rules - asyncapi-website
  • GitHub Check: Pages changed - asyncapi-website
  • GitHub Check: Lighthouse CI
🔇 Additional comments (3)
.github/workflows/slack-notifications.yml (1)

1-18:

Details

❓ Verification inconclusive

Ensure proper webhook configuration in repository secrets.

This new workflow looks well-structured for notifying Slack when pushes occur to the master branch. It uses a pinned version of the Slack notification action, which is good practice for stability.

Make sure the WEBSITE_SLACK_WEBHOOK secret is properly configured in your repository settings before merging.


🏁 Script executed:

#!/bin/bash
# Check if the required secret is set up in the repository
gh secret list | grep -i WEBSITE_SLACK_WEBHOOK || echo "Warning: WEBSITE_SLACK_WEBHOOK secret not found"

Length of output: 302


Webhook Secret Verification: Please Verify Manually

The workflow itself is well-structured and uses a pinned version of the Slack notification action. However, our automated check returned an HTTP 403 error when attempting to list the secrets (i.e., WEBSITE_SLACK_WEBHOOK), which is likely due to the GitHub integration not having sufficient permissions to access this information. As a result, the test script couldn’t confirm if the secret is actually missing.

  • Action Item: Manually verify in your repository settings that the WEBSITE_SLACK_WEBHOOK secret is properly configured with the correct value.
  • Note: The permission error in the automated check does not conclusively indicate that the secret is absent—it may simply reflect integration access limitations.
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 1-1: wrong new line character: expected \n

(new-lines)


[error] 18-18: no new line character at the end of file

(new-line-at-end-of-file)


[error] 18-18: trailing spaces

(trailing-spaces)

components/navigation/BlogPostItem.tsx (2)

58-58: Good addition of the relative class.

Adding the relative class to the list item is necessary to properly position the absolutely positioned "Featured" label. This is a good change that ensures correct positioning of the new element.


67-71:

Details

❓ Verification inconclusive

Verify that post.featured is properly documented in the interface.

Make sure that the featured property is properly documented in the IBlogPost interface. It might be worth checking if this is a new property being added to the interface.


🏁 Script executed:

#!/bin/bash
# Find the IBlogPost interface definition to verify the featured property
rg -A 20 "interface IBlogPost" --type ts

# Find any existing usage of the featured property
rg "\.featured" --type ts

Length of output: 727


Action Required: Verify Documentation for post.featured in the IBlogPost Interface

The .featured property is used in multiple components (e.g., in BlogPostItem, NewsroomBlogPosts, NewsroomSection, and blog index files). However, the initial search did not clearly reveal that it is documented within the IBlogPost interface. Please confirm that the featured property is defined and accompanied by proper documentation in the IBlogPost interface. If this is a newly added property, ensure that both its type declaration and documentation are updated accordingly.

🧰 Tools
🪛 ESLint

[error] 68-68: Replace "featured-label·bg-yellow-100·text-yellow-800·font-bold·px-2·py-1·rounded-md·absolute·top-2·left-2·z-10" with 'featured-label·bg-yellow-100·text-yellow-800·font-bold·px-2·py-1·rounded-md·absolute·top-2·left-2·z-10'

(prettier/prettier)


[error] 68-68: Unexpected usage of doublequote.

(jsx-quotes)

Comment on lines +67 to +71
{post.featured && (
<span className="featured-label bg-yellow-100 text-yellow-800 font-bold px-2 py-1 rounded-md absolute top-2 left-2 z-10">
Featured
</span>
)}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Fix string quote style to maintain consistency.

The code uses double quotes for the className which violates the project's ESLint rules. Also, consider extracting these classes to a variable or constant for better readability if this style is used elsewhere.

- <span className="featured-label bg-yellow-100 text-yellow-800 font-bold px-2 py-1 rounded-md absolute top-2 left-2 z-10">
+ <span className='featured-label bg-yellow-100 text-yellow-800 font-bold px-2 py-1 rounded-md absolute top-2 left-2 z-10'>
📝 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
{post.featured && (
<span className="featured-label bg-yellow-100 text-yellow-800 font-bold px-2 py-1 rounded-md absolute top-2 left-2 z-10">
Featured
</span>
)}
{post.featured && (
<span className='featured-label bg-yellow-100 text-yellow-800 font-bold px-2 py-1 rounded-md absolute top-2 left-2 z-10'>
Featured
</span>
)}
🧰 Tools
🪛 ESLint

[error] 68-68: Replace "featured-label·bg-yellow-100·text-yellow-800·font-bold·px-2·py-1·rounded-md·absolute·top-2·left-2·z-10" with 'featured-label·bg-yellow-100·text-yellow-800·font-bold·px-2·py-1·rounded-md·absolute·top-2·left-2·z-10'

(prettier/prettier)


[error] 68-68: Unexpected usage of doublequote.

(jsx-quotes)

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

🧹 Nitpick comments (3)
markdown/about/index.md (3)

75-75: Vary Sentence Beginnings in the "Multicultural and inclusive" Section
The updated text repeats "It's" at the start of successive sentences. To improve readability and adhere to stylistic best practices, consider rephrasing one or more sentences to vary their openings. For example, you might merge or reword sentences to reduce the repetition.

🧰 Tools
🪛 LanguageTool

[style] ~75-~75: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...always in constant mutation and change. It also actively demands compliance with h...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


95-95: Enhance Clarity in the "Blog" Section Description
The description for the Blog section now has correct apostrophes; however, starting both sentences with "It's" creates a repetitive rhythm. Consider merging the sentences or varying the structure to improve the flow. For example:

- [**Blog**](https://www.asyncapi.com/blog): It's used to disseminate information related to the project. It's also open to collaborations.
+ [**Blog**](https://www.asyncapi.com/blog): Used to disseminate project-related information and open to collaborations.

96-96: Review Sentence Structure in the "LinkedIn" Section
Similarly, the LinkedIn section repeats the phrase "It's used" for both sentences. Consider combining or rewording the statements to create a more fluid description. For example:

- [**LinkedIn**](https://es.linkedin.com/company/asyncapi): It's used to publish news related to the project or its environment. It's also used as a source of information.
+ [**LinkedIn**](https://es.linkedin.com/company/asyncapi): Publishes news related to the project and serves as a key source of information.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 908a9c3 and 17c5c33.

📒 Files selected for processing (1)
  • markdown/about/index.md (2 hunks)
🧰 Additional context used
🪛 LanguageTool
markdown/about/index.md

[style] ~75-~75: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...always in constant mutation and change. It also actively demands compliance with h...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

⏰ Context from checks skipped due to timeout of 180000ms (3)
  • GitHub Check: Redirect rules - asyncapi-website
  • GitHub Check: Header rules - asyncapi-website
  • GitHub Check: Pages changed - asyncapi-website
🔇 Additional comments (3)
markdown/about/index.md (3)

67-67: Consistent Company Description for SAP
The updated SAP entry now uses a consistent punctuation style with straight apostrophes. The description is clear and maintains uniformity with the rest of the companies section.


73-73: Typographical Fix in the "Free" Value
The "Free" value text now correctly uses straight apostrophes and maintains consistency. The sentence structure is clear.


97-97: Clear and Concise YouTube Channel Description
The updated description for the YouTube Channel is succinct and clear. No further changes are needed.

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

🧹 Nitpick comments (3)
tests/build-pages.test.js (2)

52-55: Good addition of cleanup before test.

This change properly ensures the test directory is clean before running the test, which prevents potential failures from previous test runs.

Consider using fs.rmSync() with the recursive option for more robust directory cleanup:

// Clean up directory if it exists before test
if (fs.existsSync(NEW_TEST_DIR)) {
-  fs.rmdirSync(NEW_TEST_DIR);
+  fs.rmSync(NEW_TEST_DIR, { recursive: true, force: true });
}

This would handle cases where the directory might contain files from a failed previous test run.


61-63: Good test cleanup practice.

Adding cleanup after the test is completed ensures that test artifacts don't interfere with future test runs.

Similar to the pre-test cleanup, consider using fs.rmSync() with the recursive option for more robust directory removal:

// Clean up after test
-fs.rmdirSync(NEW_TEST_DIR);
+fs.rmSync(NEW_TEST_DIR, { recursive: true, force: true });
scripts/dashboard/build-dashboard.js (1)

155-164: Improved month calculation logic.

The new implementation of monthsSince provides a more accurate calculation by properly accounting for year and month differences, along with a correction for the day of the month.

Consider adding unit tests to verify the function works correctly with various date scenarios. For example:

// Test cases for monthsSince function
test('monthsSince calculates correctly when current day is greater than target day', () => {
  const then = new Date(2022, 0, 15); // January 15, 2022
  const now = new Date(2022, 3, 20);  // April 20, 2022
  
  // Mock the current date
  const originalDate = global.Date;
  global.Date = class extends Date {
    constructor() {
      return now;
    }
  };
  
  expect(monthsSince(then)).toBe(3);
  
  // Restore original Date
  global.Date = originalDate;
});

test('monthsSince calculates correctly when current day is less than target day', () => {
  const then = new Date(2022, 0, 25); // January 25, 2022
  const now = new Date(2022, 3, 20);  // April 20, 2022
  
  // Mock the current date
  const originalDate = global.Date;
  global.Date = class extends Date {
    constructor() {
      return now;
    }
  };
  
  expect(monthsSince(then)).toBe(2); // Should be 2 months due to day adjustment
  
  // Restore original Date
  global.Date = originalDate;
});
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 17c5c33 and b8ba95d.

📒 Files selected for processing (2)
  • scripts/dashboard/build-dashboard.js (1 hunks)
  • tests/build-pages.test.js (1 hunks)
🔇 Additional comments (1)
scripts/dashboard/build-dashboard.js (1)

97-97:

Details

❓ Verification inconclusive

Verify impact of monthsSince changes on hot discussions scoring.

The changes to the monthsSince function will potentially affect the scoring calculation for hot discussions, which uses this function in an exponentiated denominator. The improved accuracy is good, but it may change which discussions appear in the dashboard.


🏁 Script executed:

#!/bin/bash
# Description: Check for usage of monthsSince in the codebase

echo "Checking for monthsSince usage across the codebase:"
rg -n "monthsSince" --glob="!scripts/dashboard/build-dashboard.js"

echo "\nChecking if there are any tests for the monthsSince function:"
rg -n "test.*monthsSince|describe.*monthsSince" --glob="*.test.js"

Length of output: 525


Hot Discussion Scoring – Validate Impact of monthsSince Changes

The updated logic in monthsSince now improves accuracy, but its use in the hot discussions scoring (as seen in scripts/dashboard/build-dashboard.js at line 97) might alter discussion rankings. Although there are tests (e.g., in tests/dashboard/build-dashboard.test.js around lines 7 and 144) that reference monthsSince, please verify that the updated calculation still meets the intended scoring behavior and product requirements. In particular:

  • Double-check that the adjusted denominator exponentiation still produces expected scores for hot discussions.
  • Ensure any changes in scoring due to enhanced accuracy are consistent with dashboard expectations.
  • Confirm that regression tests (especially those in tests/dashboard/build-dashboard.test.js) adequately cover these impacts.
🧰 Tools
🪛 ESLint

[error] 97-97: 'monthsSince' was used before it was defined.

(no-use-before-define)

@akshatnema
Copy link
Member

This issue will be considered under Bounty program hence closing this issue.

@akshatnema akshatnema closed this Mar 6, 2025
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