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

Ci/notify discussions release #643

Merged
merged 2 commits into from
Oct 16, 2024
Merged

Ci/notify discussions release #643

merged 2 commits into from
Oct 16, 2024

Conversation

ccamel
Copy link
Member

@ccamel ccamel commented Oct 15, 2024

Addresses axone-protocol/community#6.

  • Additionally, removes Discord notifications on release, as GitHub Discussions will now serve as the primary release notification channel, with optional forwarding to Discord if needed.
  • Also enables manual triggering with a specific tag input (only for the notification of release on discussions), alongside the default trigger on release. This adds flexibility for replaying the workflow when necessary.​

Summary by CodeRabbit

  • New Features

    • Introduced a manual trigger for workflows with an optional input parameter for tagging.
    • Added a new job to set environment variables, improving workflow clarity.
    • Enhanced messaging format for notifications related to GitHub discussions.
  • Improvements

    • Updated logic for retrieving the latest release tag.
    • Restructured jobs to ensure efficient execution based on specific events.

Copy link

coderabbitai bot commented Oct 15, 2024

Walkthrough

The workflow file .github/workflows/notify-release.yml has been significantly updated. A new trigger, workflow_dispatch, allows for manual invocation with an optional tag input. The job notify-discord has been renamed to set-env, which now sets environment variables and exposes tag and repo_name as outputs. The notify-github-discussion job has been modified to depend on set-env and has undergone structural changes to improve its operations. Additionally, the update-docs and update-schema jobs now include checks to prevent execution during manual dispatch.

Changes

File Change Summary
.github/workflows/notify-release.yml - Added workflow_dispatch trigger with optional tag input.
- Renamed notify-discord to set-env.
- set-env now sets and exposes tag and repo_name as outputs.
- Updated logic to retrieve tag using GitHub CLI if INPUT_TAG is not provided.
- Modified notify-github-discussion to depend on set-env and restructured its steps.
- Added repository checkout step and updated changelog extraction.
- Added conditional checks to update-docs and update-schema to prevent execution on manual dispatch.

Poem

In the garden of code, where changes bloom,
A rabbit hops lightly, dispelling the gloom.
With tags and with triggers, we dance in delight,
Setting envs and outputs, our workflow takes flight!
So here's to the updates, both clever and bright,
A hop and a skip, everything feels right! 🐇✨


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.

@ccamel ccamel self-assigned this Oct 15, 2024
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: 0

🧹 Outside diff range and nitpick comments (2)
.github/workflows/notify-release.yml (2)

13-32: LGTM: Environment setup job added with minor improvements needed

The new set-env job effectively centralizes environment variable setting and improves modularity. It handles both manual input and automatic tag retrieval, which aligns with the workflow's flexibility requirements.

However, there are some minor improvements that can be made to the shell script:

Consider applying the following changes to address shellcheck warnings:

 if [ -n "$INPUT_TAG" ]; then
-  TAG="$INPUT_TAG"
+  TAG="${INPUT_TAG}"
 else
-  TAG=$(gh release view --json tagName -q '.tagName')
+  TAG="$(gh release view --json tagName -q '.tagName')"
 fi
-echo "tag=$TAG" >> $GITHUB_OUTPUT
+echo "tag=${TAG}" >> "${GITHUB_OUTPUT}"

-REPO_NAME=${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/}
-echo "repo_name=$REPO_NAME" >> $GITHUB_OUTPUT
+REPO_NAME="${GITHUB_REPOSITORY#"${GITHUB_REPOSITORY_OWNER}/"}"
+echo "repo_name=${REPO_NAME}" >> "${GITHUB_OUTPUT}"

These changes will prevent potential issues with word splitting and globbing, and ensure proper quoting of variables.

🧰 Tools
🪛 actionlint

21-21: shellcheck reported issue in this script: SC2086:info:6:20: Double quote to prevent globbing and word splitting

(shellcheck)


21-21: shellcheck reported issue in this script: SC2295:info:8:31: Expansions inside ${..} need to be quoted separately, otherwise they match as patterns

(shellcheck)


21-21: shellcheck reported issue in this script: SC2086:info:9:32: Double quote to prevent globbing and word splitting

(shellcheck)


36-77: LGTM: GitHub Discussions notification job updated

The notify-github-discussion job has been effectively updated to work with the new set-env job and improve the notification content. The changes align well with the PR objective of shifting to GitHub Discussions for release notifications.

For consistency, consider updating line 45 to use double quotes for the GitHub CLI command:

-gh release view ${{ needs.set-env.outputs.tag }} --json body -q '.body'
+gh release view "${{ needs.set-env.outputs.tag }}" --json body -q '.body'

This change ensures that the tag is properly quoted, which is especially important if it contains spaces or special characters.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between be8b0f4 and 1968c65.

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

21-21: shellcheck reported issue in this script: SC2086:info:6:20: Double quote to prevent globbing and word splitting

(shellcheck)


21-21: shellcheck reported issue in this script: SC2295:info:8:31: Expansions inside ${..} need to be quoted separately, otherwise they match as patterns

(shellcheck)


21-21: shellcheck reported issue in this script: SC2086:info:9:32: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (4)
.github/workflows/notify-release.yml (4)

7-11: LGTM: Manual workflow trigger added

The addition of the workflow_dispatch trigger with an optional tag input aligns well with the PR objective of allowing manual triggering of notifications for releases. This provides flexibility for replaying the workflow when necessary, alongside the existing release trigger.


81-81: LGTM: Docs update skipped on manual dispatch

The addition of the condition if: github.event_name != 'workflow_dispatch' is a good improvement. It prevents unnecessary documentation updates when manually triggering the workflow, which aligns with the PR objective of allowing manual notifications without side effects.


103-103: LGTM: Schema update skipped on manual dispatch

The addition of the condition if: github.event_name != 'workflow_dispatch' is a good improvement. It prevents unnecessary schema updates when manually triggering the workflow, which aligns with the PR objective of allowing manual notifications without side effects.


Line range hint 1-120: Overall: Excellent improvements to the release notification workflow

The changes in this file successfully implement the PR objectives:

  1. Removal of Discord notifications: The workflow now focuses on GitHub Discussions for release notifications.
  2. Manual triggering capability: The new workflow_dispatch trigger allows for manual invocation with an optional tag input.
  3. Streamlined communication: The notify-github-discussion job has been updated to provide comprehensive release information in GitHub Discussions.

The restructuring of the workflow improves modularity and clarity, particularly in how environment variables are handled and how notifications are formatted. The addition of conditions to skip documentation and schema updates on manual dispatch prevents unnecessary side effects.

These changes effectively shift the focus to GitHub Discussions for release notifications while maintaining flexibility for manual triggers. The workflow now provides a more streamlined and efficient process for communicating releases within the community.

🧰 Tools
🪛 actionlint

21-21: shellcheck reported issue in this script: SC2086:info:6:20: Double quote to prevent globbing and word splitting

(shellcheck)


21-21: shellcheck reported issue in this script: SC2295:info:8:31: Expansions inside ${..} need to be quoted separately, otherwise they match as patterns

(shellcheck)


21-21: shellcheck reported issue in this script: SC2086:info:9:32: Double quote to prevent globbing and word splitting

(shellcheck)

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

We will now use GitHub Discussions as the sole channel for
release notifications and forward these to Discord if needed.
@bot-anik
Copy link
Member

bot-anik commented Oct 15, 2024

size-limit report 📦

Path Size
target/wasm32-unknown-unknown/release/axone_objectarium.wasm 458.07 KB (0%)
target/wasm32-unknown-unknown/release/axone_law_stone.wasm 648.51 KB (0%)
target/wasm32-unknown-unknown/release/axone_cognitarium.wasm 882.03 KB (0%)
target/wasm32-unknown-unknown/release/axone_dataverse.wasm 683.93 KB (0%)

@ccamel ccamel force-pushed the ci/notify-discussions-release branch from 1968c65 to 32bf8e6 Compare October 15, 2024 13:15
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: 0

🧹 Outside diff range and nitpick comments (2)
.github/workflows/notify-release.yml (2)

13-32: Great job centralizing environment setup!

The new set-env job effectively centralizes environment variable setup and output exposure. It handles both manual input and automatic tag retrieval, which is very useful.

However, there are some minor improvements we can make to the shell script:

Consider applying these changes to address shellcheck warnings and improve script robustness:

 if [ -n "$INPUT_TAG" ]; then
-  TAG="$INPUT_TAG"
+  TAG="${INPUT_TAG}"
 else
-  TAG=$(gh release view --json tagName -q '.tagName')
+  TAG="$(gh release view --json tagName -q '.tagName')"
 fi
-echo "tag=$TAG" >> $GITHUB_OUTPUT
+echo "tag=${TAG}" >> "${GITHUB_OUTPUT}"

-REPO_NAME=${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/}
-echo "repo_name=$REPO_NAME" >> $GITHUB_OUTPUT
+REPO_NAME="${GITHUB_REPOSITORY#"${GITHUB_REPOSITORY_OWNER}/"}"
+echo "repo_name=${REPO_NAME}" >> "${GITHUB_OUTPUT}"

These changes ensure proper quoting and prevent potential issues with word splitting or globbing.

🧰 Tools
🪛 actionlint

21-21: shellcheck reported issue in this script: SC2086:info:6:20: Double quote to prevent globbing and word splitting

(shellcheck)


21-21: shellcheck reported issue in this script: SC2295:info:8:31: Expansions inside ${..} need to be quoted separately, otherwise they match as patterns

(shellcheck)


21-21: shellcheck reported issue in this script: SC2086:info:9:32: Double quote to prevent globbing and word splitting

(shellcheck)


36-77: Excellent improvements to the GitHub Discussions notification!

The updates to the notify-github-discussion job are well-structured and improve the overall functionality:

  • Proper dependency on the set-env job ensures correct sequencing.
  • Addition of the repository checkout step provides flexibility for future enhancements.
  • Changelog extraction now correctly uses the tag from set-env.
  • The discussion creation step has been significantly improved with a more informative title and body.

For consistency, consider updating the body section to use needs.set-env.outputs.tag instead of github.event.release.tag_name:

-📄 Changelog: <https://github.com/${{ github.repository }}/releases/tag/${{ needs.set-env.outputs.tag }}>
+📄 Changelog: <https://github.com/${{ github.repository }}/releases/tag/${{ needs.set-env.outputs.tag }}>

This change ensures that the correct tag is always used, whether the workflow was triggered manually or automatically.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1968c65 and 32bf8e6.

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

21-21: shellcheck reported issue in this script: SC2086:info:6:20: Double quote to prevent globbing and word splitting

(shellcheck)


21-21: shellcheck reported issue in this script: SC2295:info:8:31: Expansions inside ${..} need to be quoted separately, otherwise they match as patterns

(shellcheck)


21-21: shellcheck reported issue in this script: SC2086:info:9:32: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (4)
.github/workflows/notify-release.yml (4)

7-11: Excellent addition of manual workflow trigger!

The new workflow_dispatch trigger enhances the flexibility of this workflow by allowing manual invocation. The optional tag input is particularly useful for specifying a particular release tag when needed.


81-81: Good addition of execution condition!

The condition if: github.event_name != 'workflow_dispatch' is a smart addition. It prevents unnecessary documentation updates when the workflow is manually triggered, avoiding potential unintended side effects.


103-103: Consistent application of execution condition!

The addition of if: github.event_name != 'workflow_dispatch' to the update-schema job is consistent with the approach taken in the update-docs job. This ensures that schema updates are only triggered by actual releases, not manual workflow runs.


Line range hint 1-118: Overall excellent improvements to the notify-release workflow!

This update significantly enhances the workflow's flexibility, maintainability, and functionality:

  1. Addition of manual triggering with optional tag input.
  2. Centralized environment setup with the new set-env job.
  3. Improved GitHub Discussions notification with better formatting and content.
  4. Consistent handling of manual triggers for docs and schema updates.

These changes collectively make the workflow more robust and user-friendly. The code is well-structured, and the use of environment variables and secrets is appropriate. The minor suggestions provided in previous comments will further improve the script's robustness and consistency.

Great job on this refactoring!

🧰 Tools
🪛 actionlint

21-21: shellcheck reported issue in this script: SC2086:info:6:20: Double quote to prevent globbing and word splitting

(shellcheck)


21-21: shellcheck reported issue in this script: SC2295:info:8:31: Expansions inside ${..} need to be quoted separately, otherwise they match as patterns

(shellcheck)


21-21: shellcheck reported issue in this script: SC2086:info:9:32: Double quote to prevent globbing and word splitting

(shellcheck)

@ccamel ccamel requested review from amimart and bdeneux October 15, 2024 13:21
@ccamel ccamel force-pushed the ci/notify-discussions-release branch from 32bf8e6 to 38f4a0a Compare October 16, 2024 08:31
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: 0

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

13-32: LGTM! Consider improving shell script robustness.

The set-env job effectively centralizes the logic for setting important environment variables and handles both manual input and automatic tag retrieval. This structure improves the workflow's modularity and clarity.

To enhance the shell script's robustness, consider the following improvements:

  1. Quote the $INPUT_TAG variable to prevent word splitting:
-if [ -n "$INPUT_TAG" ]; then
-  TAG="$INPUT_TAG"
+if [ -n "${INPUT_TAG}" ]; then
+  TAG="${INPUT_TAG}"
  1. Quote the ${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/} expansion:
-REPO_NAME=${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/}
+REPO_NAME="${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/}"

These changes will make the script more resilient to potential issues with special characters or spaces in the variables.

🧰 Tools
🪛 actionlint

21-21: shellcheck reported issue in this script: SC2086:info:6:20: Double quote to prevent globbing and word splitting

(shellcheck)


21-21: shellcheck reported issue in this script: SC2295:info:8:31: Expansions inside ${..} need to be quoted separately, otherwise they match as patterns

(shellcheck)


21-21: shellcheck reported issue in this script: SC2086:info:9:32: Double quote to prevent globbing and word splitting

(shellcheck)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 32bf8e6 and 38f4a0a.

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

21-21: shellcheck reported issue in this script: SC2086:info:6:20: Double quote to prevent globbing and word splitting

(shellcheck)


21-21: shellcheck reported issue in this script: SC2295:info:8:31: Expansions inside ${..} need to be quoted separately, otherwise they match as patterns

(shellcheck)


21-21: shellcheck reported issue in this script: SC2086:info:9:32: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (5)
.github/workflows/notify-release.yml (5)

7-11: LGTM! Great addition for manual workflow triggering.

The new workflow_dispatch trigger with an optional tag input aligns perfectly with the PR objective of allowing manual triggering of notifications for releases. This addition provides flexibility and control over the notification process.


36-77: LGTM! Excellent improvements to the notification process.

The updates to the notify-github-discussion job significantly enhance the notification process:

  1. The dependency on set-env ensures access to the required outputs, improving modularity.
  2. The addition of the repository checkout step allows for proper access to release information.
  3. The changelog extraction now correctly uses the tag output from set-env.
  4. The announcement discussion format has been improved with more detailed and structured information.
  5. The use of environment variables for sensitive information (e.g., DISCORD_URL, TWITTER_URL) is a good security practice.

These changes align well with the PR objectives and improve the overall quality of the release notification process.


81-81: LGTM! Good addition to prevent unnecessary doc updates.

The condition if: github.event_name != 'workflow_dispatch' ensures that the update-docs job only runs for automatic releases and not during manual notification triggers. This change aligns with the PR objectives and prevents unnecessary documentation updates when manually replaying the workflow.


103-103: LGTM! Good addition to prevent unnecessary schema updates.

The condition if: github.event_name != 'workflow_dispatch' ensures that the update-schema job only runs for automatic releases and not during manual notification triggers. This change aligns with the PR objectives and prevents unnecessary schema updates when manually replaying the workflow.


Line range hint 1-118: Overall, excellent improvements to the release notification workflow!

The changes in this file successfully achieve the PR objectives:

  1. Manual triggering of notifications is now possible with the workflow_dispatch event.
  2. The notification process has been improved and centralized with the new set-env job.
  3. The GitHub Discussions announcement has been enhanced with more detailed information.
  4. Unnecessary updates to docs and schema during manual triggers have been prevented.

These changes improve the flexibility, clarity, and efficiency of the release notification process. The only minor suggestion is to improve the shell script robustness in the set-env job, as mentioned in a previous comment.

Great work on this update!

🧰 Tools
🪛 actionlint

21-21: shellcheck reported issue in this script: SC2086:info:6:20: Double quote to prevent globbing and word splitting

(shellcheck)


21-21: shellcheck reported issue in this script: SC2295:info:8:31: Expansions inside ${..} need to be quoted separately, otherwise they match as patterns

(shellcheck)


21-21: shellcheck reported issue in this script: SC2086:info:9:32: Double quote to prevent globbing and word splitting

(shellcheck)

Copy link
Contributor

@bdeneux bdeneux left a comment

Choose a reason for hiding this comment

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

👍

@ccamel ccamel merged commit 5d34d10 into main Oct 16, 2024
18 checks passed
@ccamel ccamel deleted the ci/notify-discussions-release branch October 16, 2024 16:48
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.

4 participants