Home

Awesome

Fossilize - Mastodon account backup tool

This Action will help you backup Mastodon account items to CSV files, including:

The export is performed using the Mastodon API and an Access Token.

Note that Followers and Posts cannot be imported using Mastodon's import web interface. Also, posts are exported in JSON format because they are more complex.

Documentation

Here's how you'd export your follows, lists, blocks, mutes, domain_blocks, bookmarks, followers, and posts if your account is on the dataplatform.social Mastodon instance. This will export the files to ./backups then attach a zip of the ./backups as an artifact to the workflow run.

- name: Backup account to files
  uses: potatoqualitee/fossilize@v1
    with:
        server: dataplatform.social
    env:
        ACCESS_TOKEN: "${{ secrets.ACCESS_TOKEN }}"

Note that Mastodon limits API calls to 300 per 5 minutes, which averages 1 second so each call will have a delay of one second, so that's why there seems to be a slight delay.

Usage

Pre-requisites

Get a Mastodon Bearer Token

A Mastodon token is required for this Action to work. Fortuantely, it's very easy to get one.

Go to your Mastodon profile/client/webpage and click Preferences -> Development -> New Application -> Application name: Whatever you like, I named mine Imports -> Limit Permissions (optional) -> Submit

Note

If you limit your permissions too much when you create the app, you may need to recreate it. I was too strict with my permissions and it looked like I could edit them but the edit is like a secondary scope

Click new application link -> Your access token

Add GitHub Secrets

Once you have your authentication information, you will need to them to your repository secrets.

I named my secret ACCESS_TOKEN. You can use any secretname you want, though you must ensure that your environmental variables are named appropriately, as seen in the sample code.

Create workflows

Finally, create a workflow .yml file in your repositories .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.

Inputs

Outputs

Example workflows

Use the Fossilize action to backup your account to CSV each night at midnight and attach the zip as an artifact

name: Backup Mastodon Account
on:
  workflow_dispatch:
  schedule:
    - cron: "0 0 * * *"
jobs:
  backup:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout the code
        uses: actions/checkout@v3

      - name: Backup Mastodon Account
        uses: potatoqualitee/fossilize@v1
        id: backup
        with:
          server: dataplatform.social
        env:
          ACCESS_TOKEN: "${{ secrets.ACCESS_TOKEN }}"

Details

Here's some extra examples for the inputs.

InputExampleAnother ExampleAnd Another
serverdataplatform.socialdbatools@dataplatform.socialhttps://dataplatform.social
path/tmp/backups./backups

Want to run this locally?

Just add your $env:ACCESS_TOKEN environmental variables to your $profile and reload, clone the repo, change directories, modify this command and run.

./main.ps1 -Server yourinstance.tld -Path C:\temp\backups

Contributing

Pull requests are welcome!

You may also enjoy...

TODO

You tell me! I'm open to suggestions. But also

License

The scripts and documentation in this project are released under the MIT License