-
Notifications
You must be signed in to change notification settings - Fork 24
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
fix: mastodonbot #187
fix: mastodonbot #187
Conversation
Warning Rate limit exceeded@cmeesters has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 15 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
WalkthroughThe pull request modifies the GitHub Actions workflow for posting to Mastodon upon a push event instead of a pull request merge. The trigger for the workflow has changed from Changes
Possibly related PRs
Suggested reviewers
Poem
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? 🪧 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: 1
🔭 Outside diff range comments (2)
.github/workflows/post_to_mastodon.yml (2)
Line range hint
4-8
: Workflow configuration needs revision to match requirementsThere are several issues with the current workflow trigger configuration:
- The
types: [closed]
is invalid forpush
events (it's only valid forpull_request
events)- The current trigger doesn't match the PR objective of "only publishing updates on releases"
To fix these issues and align with the requirement to post only on releases, modify the trigger to:
- push: - branches: - - main - types: - - closed + release: + types: + - publishedAdditionally, the job condition
if: github.event.pull_request.merged == true
will need to be removed as it won't work with release events.🧰 Tools
🪛 actionlint (1.7.4)
4-4: "types" cannot be specified for "push" Webhook event
(events)
Critical: Missing script and incorrect event trigger configuration
The workflow has multiple issues that need to be addressed:
- The
post_to_mastodon.sh
script is missing from the repository- The workflow configuration mixes push and pull request event properties incorrectly:
- Uses
push
event but checksgithub.event.pull_request.merged
- Includes
types
underpush
event which is invalid🔗 Analysis chain
Line range hint
1-27
: Verify script compatibility with release eventsLet's verify the existence and compatibility of the post_to_mastodon.sh script with release events.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check if the script exists and examine its content if [ -f "post_to_mastodon.sh" ]; then echo "Script exists. Checking content:" cat post_to_mastodon.sh else echo "Warning: post_to_mastodon.sh not found in repository" fiLength of output: 147
Script:
#!/bin/bash # Search for any mastodon-related shell scripts fd -e sh -g '*mastodon*.sh' # Check PR files for potential script addition gh pr view ${{ github.event.pull_request.number }} --json files -q '.files[].path'Length of output: 158
🧰 Tools
🪛 actionlint (1.7.4)
4-4: "types" cannot be specified for "push" Webhook event
(events)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/post_to_mastodon.yml
(2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/post_to_mastodon.yml
4-4: "types" cannot be specified for "push" Webhook event
(events)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: formatting
- GitHub Check: testing
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
🔭 Outside diff range comments (2)
.github/workflows/post_to_mastodon.yml (2)
Line range hint
4-8
: Fix the workflow trigger to respond to releases.The current trigger configuration has issues:
types
is not valid forpush
events- This won't achieve the goal of posting only on releases
Apply this diff to fix the trigger:
- push: - branches: - - main - types: - - closed + release: + types: + - released🧰 Tools
🪛 actionlint (1.7.4)
4-4: "types" cannot be specified for "push" Webhook event
(events)
Line range hint
14-14
: Remove the PR merge condition.Since we're switching to release events, the PR merge condition should be removed as it won't work with release events.
Remove this line:
- if: github.event.pull_request.merged == true
🧰 Tools
🪛 actionlint (1.7.4)
4-4: "types" cannot be specified for "push" Webhook event
(events)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/post_to_mastodon.yml
(2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/post_to_mastodon.yml
4-4: "types" cannot be specified for "push" Webhook event
(events)
20-20: key "uses" is duplicated in element of "steps" section. previously defined at line:19,col:9
(syntax-check)
22-22: input "timeout_minutes" is not defined in action "actions/checkout@v4". available inputs are "clean", "fetch-depth", "fetch-tags", "filter", "github-server-url", "lfs", "path", "persist-credentials", "ref", "repository", "set-safe-directory", "show-progress", "sparse-checkout", "sparse-checkout-cone-mode", "ssh-key", "ssh-known-hosts", "ssh-strict", "ssh-user", "submodules", "token"
(action)
23-23: input "max_attempts" is not defined in action "actions/checkout@v4". available inputs are "clean", "fetch-depth", "fetch-tags", "filter", "github-server-url", "lfs", "path", "persist-credentials", "ref", "repository", "set-safe-directory", "show-progress", "sparse-checkout", "sparse-checkout-cone-mode", "ssh-key", "ssh-known-hosts", "ssh-strict", "ssh-user", "submodules", "token"
(action)
24-24: input "command" is not defined in action "actions/checkout@v4". available inputs are "clean", "fetch-depth", "fetch-tags", "filter", "github-server-url", "lfs", "path", "persist-credentials", "ref", "repository", "set-safe-directory", "show-progress", "sparse-checkout", "sparse-checkout-cone-mode", "ssh-key", "ssh-known-hosts", "ssh-strict", "ssh-user", "submodules", "token"
(action)
🪛 yamllint (1.35.1)
.github/workflows/post_to_mastodon.yml
[error] 20-20: duplication of key "uses" in mapping
(key-duplicates)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: testing
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
🔭 Outside diff range comments (2)
.github/workflows/post_to_mastodon.yml (2)
Line range hint
4-8
: Fix workflow trigger to post only on releasesThe current trigger configuration has several issues:
- The
types
field is not valid forpush
events- This configuration won't achieve the goal of posting only on releases
To post only on releases, replace the trigger with:
- push: - branches: - - main - types: - - closed + release: + types: + - published🧰 Tools
🪛 actionlint (1.7.4)
4-4: "types" cannot be specified for "push" Webhook event
(events)
Line range hint
14-14
: Fix job condition for release eventsThe current condition checks for merged pull requests, but the workflow should run on releases.
Remove or update the condition:
- if: github.event.pull_request.merged == true + if: github.event.action == 'published'🧰 Tools
🪛 actionlint (1.7.4)
4-4: "types" cannot be specified for "push" Webhook event
(events)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/post_to_mastodon.yml
(2 hunks)
🧰 Additional context used
📓 Learnings (1)
.github/workflows/post_to_mastodon.yml (1)
Learnt from: cmeesters
PR: snakemake/snakemake-executor-plugin-slurm#187
File: .github/workflows/post_to_mastodon.yml:0-0
Timestamp: 2025-01-17T17:27:32.446Z
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.
🪛 actionlint (1.7.4)
.github/workflows/post_to_mastodon.yml
4-4: "types" cannot be specified for "push" Webhook event
(events)
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
🔭 Outside diff range comments (2)
.github/workflows/post_to_mastodon.yml (2)
Line range hint
4-8
: Fix workflow trigger configurationThe current trigger configuration has several issues:
- The
types
field is not valid forpush
events- The workflow might not work as expected since
github.event.pull_request
context may not be available in push eventsConsider using one of these approaches:
- For release-based posts (recommended based on PR objectives):
on: release: types: [published]
- For PR merge-based posts:
on: pull_request: types: [closed] branches: - main🧰 Tools
🪛 actionlint (1.7.4)
4-4: "types" cannot be specified for "push" Webhook event
(events)
Line range hint
14-14
: Update job condition to match the trigger eventThe condition
github.event.pull_request.merged == true
won't work with push events as the pull_request context isn't available.If you want to post on releases (as per PR objectives), remove this condition as it's not needed. The workflow will only run when a release is published.
If you want to keep PR merge posts, switch back to pull_request event and keep this condition.
🧰 Tools
🪛 actionlint (1.7.4)
4-4: "types" cannot be specified for "push" Webhook event
(events)
🧹 Nitpick comments (1)
.github/workflows/post_to_mastodon.yml (1)
Line range hint
1-27
: Align workflow with PR objectivesThe PR aims to change the bot to post only on releases, but the current implementation mixes push events with PR contexts, which won't work reliably.
Here's a complete workflow aligned with the PR objectives:
name: Post to Mastodon on Release on: release: types: [published] permissions: pull-requests: read jobs: post_to_mastodon: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Post to Mastodon uses: nick-fields/retry@v2 with: timeout_minutes: 2 max_attempts: 3 command: | export MASTODONBOT="${{ secrets.MASTODONBOT }}" export PR_TITLE="${{ github.event.release.tag_name }}" $GITHUB_WORKSPACE/post_to_mastodon.sh🧰 Tools
🪛 actionlint (1.7.4)
24-24: got unexpected character '#' while lexing expression, expecting 'a'..'z', 'A'..'Z', '_', '0'..'9', ''', '}', '(', ')', '[', ']', '.', '!', '<', '>', '=', '&', '|', '*', ',', ' '
(expression)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/post_to_mastodon.yml
(2 hunks)
🧰 Additional context used
📓 Learnings (1)
.github/workflows/post_to_mastodon.yml (1)
Learnt from: cmeesters
PR: snakemake/snakemake-executor-plugin-slurm#187
File: .github/workflows/post_to_mastodon.yml:0-0
Timestamp: 2025-01-17T17:27:32.446Z
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.
🪛 actionlint (1.7.4)
.github/workflows/post_to_mastodon.yml
4-4: "types" cannot be specified for "push" Webhook event
(events)
24-24: got unexpected character '#' while lexing expression, expecting 'a'..'z', 'A'..'Z', '_', '0'..'9', ''', '}', '(', ')', '[', ']', '.', '!', '<', '>', '=', '&', '|', '*', ',', ' '
(expression)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: testing
export MASTODONBOT="${{ secrets.MASTODONBOT }}" | ||
export PR_TITLE="${{ github.event.pull_request.title }}" | ||
./post_to_mastodon.sh | ||
export PR_TITLE="${{ github.event.release.tag_name#v }}" |
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.
Fix the release tag name expression
The current syntax #v
for removing the 'v' prefix is incorrect. GitHub Actions expressions don't support this string manipulation.
Use this approach instead:
export PR_TITLE="${{ github.event.release.tag_name }}"
# Then in the script, use shell parameter expansion to remove 'v' prefix
PR_TITLE=${PR_TITLE#v}
Or move the prefix removal to the script to keep the workflow simpler:
export PR_TITLE="${{ github.event.release.tag_name }}"
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.
thanks. done. hopefully.
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.
@cmeesters The changes look good! The workflow file now correctly handles the release tag name.
🔗 Analysis chain
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check the current content of the workflow file
cat .github/workflows/post_to_mastodon.yml
Length of output: 662
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
🤖 I have created a release *beep* *boop* --- ## [0.14.1](v0.14.0...v0.14.1) (2025-01-17) ### Bug Fixes * mastodonbot ([#187](#187)) ([9c2fd03](9c2fd03)) --- This PR was generated with [Release Please](/~https://github.com/googleapis/release-please). See [documentation](/~https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@coderabbitai I am a little disappointed: The aim was that this action runs upon a branch's merger to the main branch. However, it did not run at all. Any ideas why? Perhaps suggestions? |
Tip For best results, initiate chat on the files or code changes. @cmeesters I found several issues in the workflow configuration that explain why it's not running:
Here's the corrected workflow configuration: name: Post to Mastodon on PR Merge
on:
pull_request:
types:
- closed
branches:
- main
permissions:
pull-requests: read
jobs:
post_to_mastodon:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Post to Mastodon
uses: nick-fields/retry@v2
with:
timeout_minutes: 2
max_attempts: 3
command: |
export MASTODONBOT="${{ secrets.MASTODONBOT }}"
export PR_TITLE="${{ github.event.pull_request.title }}"
$GITHUB_WORKSPACE/post_to_mastodon.sh The main changes:
This should now run whenever a PR is merged to the main branch. Would you like me to explain any part in more detail? 🔗 Analysis chain🏁 Scripts executedThe following scripts were executed for the analysis: Script:
Length of output: 662 |
attempt to fix the mastodon publisher:
Summary by CodeRabbit