Skip to content

Commit 9c2fd03

Browse files
authored
fix: mastodonbot (#187)
attempt to fix the mastodon publisher: - that the bot does not post on merged pull request, but only on releases (it used to publish the merge and the release) - that the script is found (./post_to_mastodon.sh does not seem to work, perhaps $(pwd)/post_to_mastodon.sh will?) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Chores** - Updated GitHub Actions workflow for Mastodon posting. - Modified workflow trigger to run on push to the main branch after a pull request merge. - Changed environment variable to use release tag name instead of pull request title. - Added a step to check out the repository. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent ae72d2b commit 9c2fd03

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

.github/workflows/post_to_mastodon.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
# Extract version from PR title passed as environment variable
4-
version="${PR_TITLE##* }"
3+
# Extract version from PR tag passed as environment variable
4+
version="${PR_TITLE#v}"
55

66
# Validate version format
77
if ! [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then

.github/workflows/post_to_mastodon.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Post to Mastodon on PR Merge
22

33
on:
4-
pull_request:
4+
push:
55
branches:
66
- main
77
types:
@@ -15,13 +15,13 @@ jobs:
1515
if: github.event.pull_request.merged == true
1616
runs-on: ubuntu-latest
1717
steps:
18+
- uses: actions/checkout@v4
1819
- name: Post to Mastodon
1920
uses: nick-fields/retry@v2
2021
with:
2122
timeout_minutes: 2
2223
max_attempts: 3
2324
command: |
24-
git checkout ${{ github.event.pull_request.head.sha }}
2525
export MASTODONBOT="${{ secrets.MASTODONBOT }}"
26-
export PR_TITLE="${{ github.event.pull_request.title }}"
27-
./post_to_mastodon.sh
26+
export PR_TITLE="${{ github.event.release.tag_name }}"
27+
$GITHUB_WORKSPACE/post_to_mastodon.sh

0 commit comments

Comments
 (0)