-
Notifications
You must be signed in to change notification settings - Fork 30
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
ci: mastodon action #231
Conversation
WalkthroughThis pull request introduces a new GitHub Actions workflow file ( Changes
Possibly related PRs
Suggested reviewers
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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
Theif:
condition in the jobpost_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 likeRelease
orVERSION
) 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
📒 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 variablePR_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 theon:
key correctly triggers the workflow on pull request closures on themain
branch. This fulfills the PR objective of automating release announcements for merged PRs with release-related keywords.
10-12
: Defined Minimal Permissions
Settingpull-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 thesnakemake/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.
There was a problem hiding this 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
📒 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 usingif:
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 thesnakemake/mastodon-release-post-action@v1
action is clear and uses descriptive naming. This makes it easy to understand the intended action at a glance.
There was a problem hiding this 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.
Co-authored-by: David Laehnemann <david.laehnemann@hhu.de>
Co-authored-by: David Laehnemann <david.laehnemann@hhu.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this 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
📒 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 keypaths
(plural) instead ofpath
when filtering push events by file changes. Usingpaths
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') |
There was a problem hiding this comment.
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.
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)
this PR attempts to utilize the new mastodon-github-action release.
Summary by CodeRabbit