diff --git a/.github/workflows/mastodon-post.yml b/.github/workflows/mastodon-post.yml index 73bf2b7..f8eb168 100644 --- a/.github/workflows/mastodon-post.yml +++ b/.github/workflows/mastodon-post.yml @@ -1,27 +1,30 @@ name: Send a toot to Mastodon when you post a new blog post -on: [pull_request] +on: [ pull_request ] jobs: post: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - run: | - RECENTLY_ADDED_FILES=$(git log -1 --stat --grep=publish --oneline --name-only | tr '\n' ' ') - echo $RECENTLY_ADDED_FILES - echo "RECENTLY_ADDED_FILES=$RECENTLY_ADDED_FILES" >> $GITHUB_ENV - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 10 + - uses: actions/checkout@v3 + with: + fetch-depth: '0' + - run: | + echo $GITHUB_REF + echo $GITHUB_HEAD_REF + echo $GITHUB_BASE_REF + git checkout $GITHUB_BASE_REF + RECENTLY_ADDED_FILES=$(git log -1 --stat --oneline --name-only --pretty=format:'%s | %b' | tr '\n' ' ') + echo $RECENTLY_ADDED_FILES + echo "RECENTLY_ADDED_FILES=$RECENTLY_ADDED_FILES" >> $GITHUB_ENV + - - name: Post to Mastodon - uses: sumit4613/post-to-mastodon@main - if: "contains(github.event.head_commit.message, 'publish')" - with: - message: "Hello, folks! I just posted a new blog post. Check it out!" - base-blog-url: "https://sumit4613.github.io/posts/" - access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }} - host: "fosstodon.org" - port: "443" - api: "api/v1" \ No newline at end of file + - name: Post to Mastodon + uses: sumit4613/post-to-mastodon@main + with: + message: "Hello, folks! I just posted a new blog post. Check it out!" + base_blog_url: "https://sumit4613.github.io/posts/" + access_token: ${{ secrets.MASTODON_ACCESS_TOKEN }} + host: "fosstodon.org" + port: "443" + api: "api/v1" \ No newline at end of file diff --git a/content/posts/test-github-action.md b/content/posts/test-github-action.md index 385f1a6..c3125b7 100644 --- a/content/posts/test-github-action.md +++ b/content/posts/test-github-action.md @@ -2,4 +2,4 @@ new change -another change \ No newline at end of file +let's see if action works or not \ No newline at end of file