|
1 | 1 | name: Post to BlueSky
|
2 | 2 |
|
3 | 3 | on:
|
| 4 | + # Trigger automatically when a PR is merged |
4 | 5 | pull_request:
|
5 | 6 | types:
|
6 | 7 | - closed
|
| 8 | + # Allow manual triggering |
7 | 9 | workflow_dispatch:
|
8 | 10 | inputs:
|
9 | 11 | text:
|
10 |
| - description: 'Post Text' |
| 12 | + description: 'Post Text (Required for manual trigger)' |
11 | 13 | required: true
|
12 |
| - type: choice |
13 |
| - options: |
14 |
| - - patch |
15 |
| - - minor |
16 |
| - - major |
| 14 | + type: string |
17 | 15 | link:
|
18 |
| - description: 'Links' |
| 16 | + description: 'Link URL for Preview (Required for manual trigger)' |
19 | 17 | required: true
|
20 | 18 | type: string
|
| 19 | + # authorName input is kept as requested, but not directly used in the post step below. |
| 20 | + # You might want to incorporate it into the 'text' input manually when triggering. |
21 | 21 | authorName:
|
22 |
| - description: 'Author Name' |
23 |
| - required: true |
| 22 | + description: 'Author Name (Optional, for information)' |
| 23 | + required: false |
24 | 24 | type: string
|
25 | 25 |
|
26 | 26 | jobs:
|
27 |
| - if_merged: |
28 |
| - if: github.event.pull_request.merged == true |
| 27 | + # Job for posting when a PR is merged |
| 28 | + post_on_merge: |
| 29 | + # Only run this job for the pull_request trigger IF it was merged |
| 30 | + if: github.event_name == 'pull_request' && github.event.pull_request.merged == true |
| 31 | + runs-on: ubuntu-latest |
| 32 | + steps: |
| 33 | + - name: Post Merged PR to BlueSky |
| 34 | + uses: myConsciousness/bluesky-post@v5 |
| 35 | + with: |
| 36 | + # Use PR title and author login for the text |
| 37 | + text: ${{ format('{0} by @{1}', github.event.pull_request.title, github.event.pull_request.user.login) }} |
| 38 | + # Use the PR's HTML URL for the link preview |
| 39 | + link-preview-url: ${{ github.event.pull_request.html_url }} # Use html_url, it's more standard |
| 40 | + identifier: ${{ secrets.BSKY_IDENTIFIER }} |
| 41 | + password: ${{ secrets.BSKY_PASSWORD }} |
| 42 | + |
| 43 | + # Job for posting when manually triggered |
| 44 | + post_manually: |
| 45 | + # Only run this job for the workflow_dispatch trigger |
| 46 | + if: github.event_name == 'workflow_dispatch' |
29 | 47 | runs-on: ubuntu-latest
|
30 | 48 | steps:
|
31 |
| - # - run: | |
32 |
| - # echo ${{ github.event.pull_request.title }} \n ${{ github.event.pull_request._links.html.href }} |
33 |
| - |
34 |
| - - uses: myConsciousness/bluesky-post@v5 |
| 49 | + - name: Post Manually to BlueSky |
| 50 | + uses: myConsciousness/bluesky-post@v5 |
35 | 51 | with:
|
36 |
| - text: ${{ github.event.pull_request.title }} by ${{ github.event.pull_request.user.login }} |
37 |
| - link-preview-url: ${{ github.event.pull_request._links.html.href }} |
| 52 | + # Use the text provided in the manual trigger input |
| 53 | + text: ${{ github.event.inputs.text }} |
| 54 | + # Use the link provided in the manual trigger input |
| 55 | + link-preview-url: ${{ github.event.inputs.link }} |
38 | 56 | identifier: ${{ secrets.BSKY_IDENTIFIER }}
|
39 | 57 | password: ${{ secrets.BSKY_PASSWORD }}
|
0 commit comments