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: post upon release #195

Merged
merged 9 commits into from
Jan 20, 2025
Merged

ci: post upon release #195

merged 9 commits into from
Jan 20, 2025

Conversation

cmeesters
Copy link
Member

@cmeesters cmeesters commented Jan 20, 2025

attempting fix

Summary by CodeRabbit

  • Chores
    • Updated GitHub Actions workflow to refine conditions for automatically posting release updates to Mastodon
    • Enhanced workflow trigger logic to ensure posts only occur for specific release-related pull requests

Copy link
Contributor

coderabbitai bot commented Jan 20, 2025

Walkthrough

The pull request modifies the GitHub Actions workflow file for posting to Mastodon. The change focuses on refining the job execution conditions in the .github/workflows/post_to_mastodon.yml file. The new conditional logic expands the existing trigger mechanism by adding more specific criteria for when the Mastodon posting job should run, specifically targeting pull requests with titles that start with "release" or contain " v".

Changes

File Change Summary
.github/workflows/post_to_mastodon.yml Updated job trigger conditions to require both pull request merge and specific title patterns

Possibly related PRs

Poem

🐰 A Rabbit's Workflow Tale 🚀

In GitHub's garden, workflows bloom,
Conditions dance, dispelling gloom,
Release and "v" now set the stage,
For Mastodon's social media page!
Hop, hop, deploy with glee! 🌈


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

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

🔭 Outside diff range comments (1)
.github/workflows/post_to_mastodon.yml (1)

Action version should be pinned and upgraded

Please update the workflow:

  • Pin the action version to a specific release instead of major version v2
  • Consider upgrading to v3.0.0 which includes Node 20 compatibility improvements
🔗 Analysis chain

Line range hint 21-31: Verify workflow dependencies and script permissions.

Please ensure:

  1. The shell script exists and has the correct permissions
  2. The action versions are pinned to secure versions
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the shell script exists and is executable
if [ -f ".github/workflows/post_to_mastodon.sh" ]; then
  ls -l .github/workflows/post_to_mastodon.sh
else
  echo "Warning: post_to_mastodon.sh not found"
fi

# Check action versions in the marketplace
gh api -X GET /repos/nick-fields/retry/releases/latest

Length of output: 2201

🧰 Tools
🪛 yamllint (1.35.1)

[error] 17-17: trailing spaces

(trailing-spaces)

🧹 Nitpick comments (2)
.github/workflows/post_to_mastodon.yml (2)

15-17: Consider expanding version pattern matching.

The current condition might miss some common version patterns. Consider these improvements:

  1. Remove the space requirement before 'v' to catch patterns like 'v1.0.0'
  2. Add support for more version formats
     if: |
       github.event.pull_request.merged == true &&
-      (startsWith(github.event.pull_request.title, 'release') || contains(github.event.pull_request.title, ' v'))    
+      (startsWith(github.event.pull_request.title, 'release') || contains(github.event.pull_request.title, 'v') || contains(github.event.pull_request.title, 'version'))
🧰 Tools
🪛 yamllint (1.35.1)

[error] 17-17: trailing spaces

(trailing-spaces)


17-17: Remove trailing spaces.

There are trailing spaces at the end of line 17.

-      (startsWith(github.event.pull_request.title, 'release') || contains(github.event.pull_request.title, ' v'))    
+      (startsWith(github.event.pull_request.title, 'release') || contains(github.event.pull_request.title, ' v'))
🧰 Tools
🪛 yamllint (1.35.1)

[error] 17-17: 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 d0fb3cd and 883a62b.

📒 Files selected for processing (1)
  • .github/workflows/post_to_mastodon.yml (1 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/post_to_mastodon.yml

[error] 17-17: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: testing

@cmeesters cmeesters merged commit 3900d97 into main Jan 20, 2025
6 checks passed
@cmeesters cmeesters deleted the fix/Mastodon3 branch January 20, 2025 14:13
@cmeesters
Copy link
Member Author

@coderabbitai now, upon release, the action does not run: https://github.com/snakemake/snakemake-executor-plugin-slurm/actions/runs/12870026000 Apparently, the suggested fix does not work. Ideas how to fix this?

@coderabbitai coderabbitai bot mentioned this pull request Jan 20, 2025
Copy link
Contributor

coderabbitai bot commented Jan 20, 2025

Tip

For best results, initiate chat on the files or code changes.

@cmeesters I found the issue. The post_to_mastodon workflow is currently configured to run on PR merges, but releases are being created directly by the release-please action without going through PRs. Here's how we can fix it:

name: Post to Mastodon on Release

on:
  release:
    types: [published]

permissions:
  contents: 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="release v${{ github.event.release.tag_name }}"
            chmod +x $GITHUB_WORKSPACE/.github/workflows/post_to_mastodon.sh
            $GITHUB_WORKSPACE/.github/workflows/post_to_mastodon.sh

This modification:

  1. Changes the trigger to the release event type
  2. Runs when a release is published
  3. Uses the release tag name to construct the message

Would you like me to create an issue to track this change?

🔗 Analysis chain


🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Get the workflow file content
cat .github/workflows/post_to_mastodon.yml

# Check recent releases and tags
git tag --sort=-creatordate | head -n 5

Length of output: 938


Script:

#!/bin/bash
# Check for release workflow files
fd workflow .github/workflows --exec cat {}

# Check recent commits to understand the release process
git log --oneline -n 10

Length of output: 47


Script:

#!/bin/bash
# List workflow files
ls -la .github/workflows/

# Check GitHub releases
gh release list

Length of output: 1599


Script:

#!/bin/bash
# Check release-please workflow
cat .github/workflows/release-please.yml

Length of output: 1212

This was referenced Mar 12, 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.

1 participant