Skip to content

Commit 376d56d

Browse files
committed
fix: better error handling and retries
1 parent 476dbf6 commit 376d56d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

.github/workflows/post_to_mastodon.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,16 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Post to Mastodon
14-
run: |
14+
- uses: nick-fields/retry@v2
15+
with:
16+
timeout_minutes: 2
17+
max_attempts: 3
18+
command: |
1519
curl -X POST -H "Authorization: Bearer ${{ secrets.MASTODON_ACCESS_TOKEN }}" \
1620
-F "status=Pull request #${{ github.event.pull_request.number }} merged: ${{ github.event.pull_request.title }}" \
17-
https://fediscience.org/api/v1/statuses
21+
https://fediscience.org/api/v1/statuses \
22+
-w "\nResponse code: %{http_code}\n" \
23+
-f || {
24+
echo "Failed to post to Mastodon"
25+
exit 1
26+
}

0 commit comments

Comments
 (0)