Skip to content

ci: mastodon action #231

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

Merged
merged 10 commits into from
Mar 12, 2025
Merged

ci: mastodon action #231

merged 10 commits into from
Mar 12, 2025

Conversation

cmeesters
Copy link
Member

@cmeesters cmeesters commented Mar 12, 2025

this PR attempts to utilize the new mastodon-github-action release.

Summary by CodeRabbit

  • New Features
    • A new GitHub Actions workflow automates release announcements on Mastodon, including version details and changelog links.
  • Chores
    • Removed the legacy script for posting announcements to Mastodon, enhancing the reliability of the announcement process.
    • Deleted the previous workflow for posting to Mastodon on pull request merges.

Copy link
Contributor

coderabbitai bot commented Mar 12, 2025

Walkthrough

This pull request introduces a new GitHub Actions workflow file (announce-release.yml) that automates release announcements on Mastodon when a pull request is merged into the main branch and its title contains release-related keywords. The PR also removes an obsolete workflow file (post_to_mastodon.yml) and eliminates the associated script (post_to_mastodon.sh) that handled posting functionality.

Changes

File(s) Change Summary
.github/workflows/announce-release.yml Added new workflow to announce releases on Mastodon when a pull request is merged on the main branch with release-related keywords.
.github/workflows/post_to_mastodon.sh Removed the script responsible for posting release announcements to Mastodon, which included validation and error handling.
.github/workflows/post_to_mastodon.yml Removed legacy workflow previously used for posting to Mastodon on pull request merge.

Possibly related PRs

  • ci: post upon release #195: The changes in the main PR introduce a new workflow for posting announcements to Mastodon, while this PR modifies the conditions for an existing workflow that also posts to Mastodon.
  • ci: post to mastodon #201: This PR modifies an existing script that handles the posting process, indicating a direct relationship in functionality with the main PR.
  • ci: mastodonbot #197: This PR modifies an existing workflow and script related to posting to Mastodon, indicating a direct connection in their functionality regarding release announcements.

Suggested reviewers

  • johanneskoester

Poem

I'm a rabbit on a joyful spree,
Hopping through workflows effortlessly,
Announcing releases with a swift tweet,
Old scripts retired, new ones in play,
With each change, I cheer "Hippity-Hooray!"
Celebrating code with a bunny dance today!


🪧 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.

@cmeesters cmeesters marked this pull request as ready for review March 12, 2025 14:23
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 (2)
.github/workflows/announce-release.yml (2)

13-18: Release PR Condition Check
The if: condition in the job post_to_mastodon uses logical operators to ensure that the workflow only runs for merged PRs with titles containing release-related keywords. Consider whether a case-insensitive match might further improve reliability (e.g., handling variants like Release or VERSION) if that fits the intended usage.


23-35: Message Block Formatting and Trailing Whitespace
There are several trailing whitespace issues identified on lines 25, 27, 29, 31, and 34 as well as a missing newline at the end of the file (line 35). Cleaning up these formatting issues will help pass YAML linting and maintain a cleaner codebase. For example, you could remove the extra spaces as shown below:

@@
-             Beep, Beep - I am your friendly #Snakemake release announcement bot. 
+             Beep, Beep - I am your friendly #Snakemake release announcement bot.
@@
-             
+             
@@
-             There is a new release of the Snakemake executor for #SLURM on #HPC systems. Its version is {{ version }}!
+             There is a new release of the Snakemake executor for #SLURM on #HPC systems. Its version is {{ version }}!

Also, please add a newline at the end of the file.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 25-25: trailing spaces

(trailing-spaces)


[error] 27-27: trailing spaces

(trailing-spaces)


[error] 29-29: trailing spaces

(trailing-spaces)


[error] 31-31: trailing spaces

(trailing-spaces)


[error] 34-34: trailing spaces

(trailing-spaces)


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

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 35d7dab and 97634ad.

📒 Files selected for processing (3)
  • .github/workflows/announce-release.yml (1 hunks)
  • .github/workflows/post_to_mastodon.sh (1 hunks)
  • .github/workflows/post_to_mastodon.yml (0 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/post_to_mastodon.yml
🧰 Additional context used
🧠 Learnings (1)
.github/workflows/post_to_mastodon.sh (1)
Learnt from: cmeesters
PR: snakemake/snakemake-executor-plugin-slurm#187
File: .github/workflows/post_to_mastodon.yml:0-0
Timestamp: 2025-03-12T14:05:59.840Z
Learning: In the mastodon publishing workflow for snakemake-executor-plugin-slurm, the PR_TITLE environment variable is required by the post_to_mastodon.sh script and should be preserved.
🪛 YAMLlint (1.35.1)
.github/workflows/announce-release.yml

[error] 25-25: trailing spaces

(trailing-spaces)


[error] 27-27: trailing spaces

(trailing-spaces)


[error] 29-29: trailing spaces

(trailing-spaces)


[error] 31-31: trailing spaces

(trailing-spaces)


[error] 34-34: trailing spaces

(trailing-spaces)


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

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

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: testing
🔇 Additional comments (5)
.github/workflows/post_to_mastodon.sh (1)

4-7: Improved Error Handling for Missing PR_TITLE
Redirecting the error message to standard error using >&2 ensures that when the required environment variable PR_TITLE is missing, the message is properly logged as an error. This aligns with best practices for shell scripts and improves debugging.

.github/workflows/announce-release.yml (4)

1-2: New Workflow Declaration
The workflow is clearly named "Announce Release on Mastodon", making it immediately obvious what its purpose is. This improves maintainability and documentation for the CI/CD process.


3-9: Trigger Configuration Setup
The configuration under the on: key correctly triggers the workflow on pull request closures on the main branch. This fulfills the PR objective of automating release announcements for merged PRs with release-related keywords.


10-12: Defined Minimal Permissions
Setting pull-requests: read under permissions is a good practice; it grants only the necessary access.


19-22: Job Structure and Action Usage
The job structure is clear, and leveraging the snakemake/mastodon-release-post-action@v1 action encapsulates the posting logic nicely. Ensure that the action correctly parses the provided variables such as {{ version }}, {{ changelog }}, and {{ issue_url }} during runtime.

@cmeesters cmeesters requested a review from dlaehnemann March 12, 2025 14:52
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 (1)
.github/workflows/announce-release.yml (1)

23-36: Message Template & Trailing Spaces
The multi-line message template is clear, with placeholders for dynamic content ({{ version }}, {{ changelog }}, {{ issue_url }}). However, YAML lint has flagged trailing spaces on several lines:

  • Line 25
  • Line 27
  • Line 29
  • Line 31
  • Line 34

Please remove these trailing spaces to comply with YAML formatting guidelines.

For example, in a diff-style suggestion:

-            Beep, Beep - I am your friendly #Snakemake release announcement bot.␣␣
+            Beep, Beep - I am your friendly #Snakemake release announcement bot.

Apply similar changes to lines 27, 29, 31, and 34.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 25-25: trailing spaces

(trailing-spaces)


[error] 27-27: trailing spaces

(trailing-spaces)


[error] 29-29: trailing spaces

(trailing-spaces)


[error] 31-31: trailing spaces

(trailing-spaces)


[error] 34-34: trailing spaces

(trailing-spaces)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 97634ad and 6b219d4.

📒 Files selected for processing (2)
  • .github/workflows/announce-release.yml (1 hunks)
  • .github/workflows/post_to_mastodon.sh (0 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/post_to_mastodon.sh
🧰 Additional context used
🧠 Learnings (1)
.github/workflows/announce-release.yml (1)
Learnt from: cmeesters
PR: snakemake/snakemake-executor-plugin-slurm#193
File: .github/workflows/post_to_mastodon.yml:26-26
Timestamp: 2025-03-12T14:50:33.209Z
Learning: In the snakemake-executor-plugin-slurm repository, release PRs follow the naming pattern "chore(main): release X.Y.Z" where X.Y.Z is the version number.
🪛 YAMLlint (1.35.1)
.github/workflows/announce-release.yml

[error] 25-25: trailing spaces

(trailing-spaces)


[error] 27-27: trailing spaces

(trailing-spaces)


[error] 29-29: trailing spaces

(trailing-spaces)


[error] 31-31: trailing spaces

(trailing-spaces)


[error] 34-34: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: testing
🔇 Additional comments (5)
.github/workflows/announce-release.yml (5)

1-2: Workflow Name & Basic Structure
The workflow's name and overall structure are correctly defined, clearly indicating its purpose for announcing releases on Mastodon.


3-9: Trigger Configuration
The workflow is set to trigger on pull request "closed" events for the "main" branch, which aligns with the objective of running on merged release PRs.


10-12: Permissions Setup
The permissions block is concise with read access on pull requests, which seems appropriate for this workflow.


15-17: Merged PR & Title Keyword Condition
The conditional check using if: is well-crafted to ensure that the job runs only for merged pull requests and when the title includes release-related keywords. Consider verifying that this condition covers all intended release title patterns (e.g., "chore(main): release X.Y.Z" as learned previously).


20-22: Job Step: Action Invocation
The job step invoking the snakemake/mastodon-release-post-action@v1 action is clear and uses descriptive naming. This makes it easy to understand the intended action at a glance.

Copy link
Member

@dlaehnemann dlaehnemann left a comment

Choose a reason for hiding this comment

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

Looks very nice, two suggestions on the workflow triggering / targeting.

cmeesters and others added 2 commits March 12, 2025 16:19
Co-authored-by: David Laehnemann <david.laehnemann@hhu.de>
Co-authored-by: David Laehnemann <david.laehnemann@hhu.de>
Copy link
Member

@dlaehnemann dlaehnemann left a comment

Choose a reason for hiding this comment

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

👍

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

🧹 Nitpick comments (1)
.github/workflows/announce-release.yml (1)

22-32: Trailing Whitespace Cleanup
Static analysis has detected trailing spaces on several lines (notably around lines 23, 25, 27, 29, and 32). Removing these trailing spaces will improve the file’s formatting and eliminate potential YAML linting issues.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 23-23: trailing spaces

(trailing-spaces)


[error] 25-25: trailing spaces

(trailing-spaces)


[error] 27-27: trailing spaces

(trailing-spaces)


[error] 29-29: trailing spaces

(trailing-spaces)


[error] 32-32: trailing spaces

(trailing-spaces)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6b219d4 and d5d9b61.

📒 Files selected for processing (1)
  • .github/workflows/announce-release.yml (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
.github/workflows/announce-release.yml (1)
Learnt from: cmeesters
PR: snakemake/snakemake-executor-plugin-slurm#193
File: .github/workflows/post_to_mastodon.yml:26-26
Timestamp: 2025-03-12T14:50:33.209Z
Learning: In the snakemake-executor-plugin-slurm repository, release PRs follow the naming pattern "chore(main): release X.Y.Z" where X.Y.Z is the version number.
🪛 actionlint (1.7.4)
.github/workflows/announce-release.yml

15-15: could not parse as YAML: yaml: line 15: mapping values are not allowed in this context

(syntax-check)

🪛 YAMLlint (1.35.1)
.github/workflows/announce-release.yml

[error] 23-23: trailing spaces

(trailing-spaces)


[error] 25-25: trailing spaces

(trailing-spaces)


[error] 27-27: trailing spaces

(trailing-spaces)


[error] 29-29: trailing spaces

(trailing-spaces)


[error] 32-32: trailing spaces

(trailing-spaces)


[error] 15-15: syntax error: mapping values are not allowed here

(syntax)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: testing
🔇 Additional comments (1)
.github/workflows/announce-release.yml (1)

7-8:

✅ Verification successful

Key Naming for File Path Filtering
It is recommended to use the key paths (plural) instead of path when filtering push events by file changes. Using paths ensures that GitHub Actions correctly recognizes the file filter.

-    path:
+    paths:

Action Required: Update Workflow File Key

The file filter in the workflow should use the key paths (plural) so that GitHub Actions properly recognizes the changes. Please update the configuration in .github/workflows/announce-release.yml on lines 7-8 accordingly:

  • Replace:
        path:
  • With:
        paths:


jobs:
post_to_mastodon:
if: contains(github.event.pull_request.title, 'chore(main): release')
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

❓ Verification inconclusive

YAML Parsing Issue in Condition & Event Context Mismatch
The if: condition on line 15 is causing a YAML parsing error because the expression contains a colon (in 'chore(main): release') which must be quoted. Moreover, the workflow is triggered by a push event where the property github.event.pull_request.title is not available. If the intent is to restrict announcements to release merges, consider checking the commit message (e.g., using github.event.head_commit.message) instead.

Example fix:

-    if: contains(github.event.pull_request.title, 'chore(main): release')
+    if: "contains(github.event.head_commit.message, 'chore(main): release')"

Alternatively, if you truly need to evaluate the pull request title, you might need to change the triggering event (for example, to pull_request) instead of push. Please verify the intended workflow context.


Critical YAML & Event Context Issue: Update if: Condition
The current condition causes a YAML parsing error due to the unquoted expression containing a colon, and it incorrectly references github.event.pull_request.title even though the workflow is triggered by a push event (where pull request data isn’t available). To fix this:

  • Wrap the entire expression in double quotes.
  • Change the event property to one available on push events—use github.event.head_commit.message instead.

For example, update line 15 as follows:

-    if: contains(github.event.pull_request.title, 'chore(main): release')
+    if: "contains(github.event.head_commit.message, 'chore(main): release')"

If using the pull request title is essential, then consider switching the workflow trigger to the pull_request event instead.

📝 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
if: contains(github.event.pull_request.title, 'chore(main): release')
if: "contains(github.event.head_commit.message, 'chore(main): release')"
🧰 Tools
🪛 actionlint (1.7.4)

15-15: could not parse as YAML: yaml: line 15: mapping values are not allowed in this context

(syntax-check)

🪛 YAMLlint (1.35.1)

[error] 15-15: syntax error: mapping values are not allowed here

(syntax)

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.

2 participants