Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rzr/fediverse-action

Post to fediverse from github using mastodon-lite
https://github.com/rzr/fediverse-action

activitypub bot cidcd federated fediverse fediverse-client github-action mastodon social-media

Last synced: 4 months ago
JSON representation

Post to fediverse from github using mastodon-lite

Awesome Lists containing this project

README

        

# Fediverse-Action #

[![GitHub forks](
https://img.shields.io/github/forks/rzr/fediverse-action.svg?style=social&label=Fork&maxAge=2592000
)](
https://GitHub.com/rzr/fediverse-action/network/
)
[![License](
https://img.shields.io/badge/license-ISC-blue.svg?style=flat
)](
LICENSE
)
[![NPM](
https://img.shields.io/npm/v/fediverse-action.svg
)](
https://www.npmjs.com/package/fediverse-action
)
[![dependencies Status](
https://david-dm.org/rzr/fediverse-action/status.svg
)](
https://david-dm.org/rzr/fediverse-action
)

## 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.

![](https://upload.wikimedia.org/wikipedia/commons/thumb/9/93/Fediverse_logo_proposal.svg/330px-Fediverse_logo_proposal.svg.png)

## Usage ##

### Join fediverse ###

- If you didn't before register to an instance of mastodon network:
- example:
- Once registered and logged, go to settings page to create an application:
- example:
- Go to "Settings" / "Development" / "New Application"
- example:
- example:
- Fill application name: mastodon-lite (or anything else),
ignore other fields
- Submit to generate application
- example:
- Go to application details and note "access token"
- example: "B4DC0D-DeadBeef1BadCode-1TODO-1TODOtodoTODO"

### Add secret to github ###

- From your project page:
-
- Add new secret with name "MASTODON_ACCESS_TOKEN"
and the previous encoded string as value.

### 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:

``` {.bash org-language="sh"}
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:

``` {.yml}
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.

```sh
curl "https://github.com/rzr/color-sensor-js/commit/cb4512fe.patch" | git am
git push
```

-

``` {.yml}
(...)
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:

``` {.yml}
# 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](
https://pbs.twimg.com/media/ESZE74mXkAEojrH?format=jpg&name=medium#./file/githubhackaton.jpg
)](
https://twitter.com/RzrFreeFr/status/1235750998364352512#fediverse-action#
"fediverse-action")