rzr / fediverse-action

Post to fediverse from github using mastodon-lite

Home Page:https://mastodon.social/@rzr/103772277257320621

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fediverse-Action

GitHub forks License NPM dependencies Status

About

Post notification to fediverse social web when code is updated. Currently it was tested with Mastodon service, Support for other ActivityPub services like pleroma or GNUsocial is also welcome.

Usage

Join fediverse

Add secret to github

Commit config file

To enable this "action" in any of your github hosted project, a configuration file should be located in ".github/workflow/" subdir, just like:

Back to your project you can create ".github/workflows/fediverse-action.yml" file by applying this patch from shell:

curl "https://github.com/rzr/color-sensor-js/commit/867de15f.patch"  | git am
git push

Or pick it from:

Then check action's status on github, a default message should then appears on a "mastodon.social" profile, something like:

Note default "mastodon.social" server will be used unless you override a host value:

        with:
          access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
          host: "social.bau-ha.us" # custom host if not "mastodon.social" (default)

Example:

Default message will link to your repo URL.

Customize commit message

Once posting is verified, then apply this next change to overload default message with your project's latest git commit message.

curl "https://github.com/rzr/color-sensor-js/commit/cb4512fe.patch" | git am
git push
(...)
    steps:
      - uses: actions/checkout@v1
      - id: log
        run: echo "::set-output name=message::$(git log --no-merges -1 --oneline)"
      - uses: rzr/fediverse-action@master
        with:
          access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
          message: "https://github.com/${{ github.repository }}/commit/${{ steps.log.outputs.message }} ~ #FediVerseAction"

Feel free to edit "message" input with anything you prefer.

Examples:

If you need to be less verbose you can filter on "Release x.y.z" commit messages only:

As a reference, config file should look like this:

# YAML
---
name: fediverse-action
on: [push]
jobs:
  post:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - id: log
        run: echo "::set-output name=message::$(git log --no-merges -1 --oneline)"
      - if: "contains(steps.log.outputs.message, 'Release ')"
        uses: rzr/fediverse-action@master
        with:
          access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
          message: "https://github.com/${{ github.repository }}# ${{ steps.log.outputs.message }} ~ #FediVerseAction"
          host: "mamot.fr" # If not using default "mastodon.social"

You can get inspired from this reference config file:

Feel free to also pin version to latest release (-"@master" +"@vX.Y.Z"):

Notes

If you want to crosspost to other social network, it's possible using IFTT:

Community

Projects using fediverse-action:

Feel free to add your config file and relative post to this list:

Resources

fediverse-action

About

Post to fediverse from github using mastodon-lite

https://mastodon.social/@rzr/103772277257320621

License:Other


Languages

Language:JavaScript 61.8%Language:Makefile 38.2%