Skip to content

Commit 076f7f8

Browse files
committed
publish post and check action
1 parent e7f55e4 commit 076f7f8

File tree

2 files changed

+21
-20
lines changed

2 files changed

+21
-20
lines changed
Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
name: Send a toot to Mastodon when you post a new blog post
22

3-
on: [pull_request]
3+
on: [ pull_request ]
44

55
jobs:
66
post:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v3
10-
- run: |
11-
RECENTLY_ADDED_FILES=$(git log -1 --stat --grep=publish --oneline --name-only | tr '\n' ' ')
12-
echo $RECENTLY_ADDED_FILES
13-
echo "RECENTLY_ADDED_FILES=$RECENTLY_ADDED_FILES" >> $GITHUB_ENV
14-
- name: Setup tmate session
15-
uses: mxschmitt/action-tmate@v3
16-
timeout-minutes: 10
9+
- uses: actions/checkout@v3
10+
with:
11+
fetch-depth: '0'
12+
- run: |
13+
echo $GITHUB_HEAD_REF
14+
git checkout $GITHUB_HEAD_REF
15+
RECENTLY_ADDED_FILES=$(git log -1 --stat --oneline --name-only | tr '\n' '|')
16+
echo $RECENTLY_ADDED_FILES
17+
echo "RECENTLY_ADDED_FILES=$RECENTLY_ADDED_FILES" >> $GITHUB_ENV
18+
1719
18-
- name: Post to Mastodon
19-
uses: sumit4613/post-to-mastodon@main
20-
if: "contains(github.event.head_commit.message, 'publish')"
21-
with:
22-
message: "Hello, folks! I just posted a new blog post. Check it out!"
23-
base-blog-url: "https://sumit4613.github.io/posts/"
24-
access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
25-
host: "fosstodon.org"
26-
port: "443"
27-
api: "api/v1"
20+
- name: Post to Mastodon
21+
uses: sumit4613/post-to-mastodon@main
22+
with:
23+
message: "Hello, folks! I just posted a new blog post. Check it out!"
24+
base_blog_url: "https://sumit4613.github.io/posts/"
25+
access_token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
26+
host: "fosstodon.org"
27+
port: "443"
28+
api: "api/v1"

content/posts/test-github-action.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
new change
44

5-
another change
5+
let's see if action works or not

0 commit comments

Comments
 (0)