fediverse-action

Post to fediverse from github

Usage no npm install needed!

<script type="module">
  import fediverseAction from 'https://cdn.skypack.dev/fediverse-action';
</script>

README

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/fediverse-action/commit/40dc.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 config file

Apply this change to update message with top commit line:

curl https://github.com/abandonware/bmp085-sensor/commit/5701e5c3.patch | git am
(...)
    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 }}# ${{ steps.log.outputs.message }} ~ #FediVerseAction"

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"

Feel free to replace "message" input with anything.

You can get inspired from this reference config file:

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

Community

Projects using fediverse-action:

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

Resources

fediverse-action