GitHub Action
Modrinth Auto-Description
Automatically update the description for a Modrinth project from a markdown file in the repo.
In order to have images and links, you must use absolute urls, meaning
don't use img.png
, use https://example.com/img.png
.
For GitHub paths, you can use https://raw.githubusercontent.com/<username>/<repo>/<branch>/<path>
.
If your readme contains front matter (either yaml or json), you can send additional data to the Modrinth API.
All additional data can be found in the Modrinth Docs.
Note: The body
key should not be specified and will be ignored if it is.
JSON:
---
{
"modrinth": {
"source_url": "https://github.com/funnyboy-roks/mapify"
}
}
---
# Your content here...
YAML:
---
modrinth:
source_url: 'https://github.com/funnyboy-roks/mapify'
---
# Your content here...
Required
The auth token to use for the Modrinth API
To get this, you need to:
- Go to https://modrinth.com/settings/pats and sign in if you aren't already
- Click "Create a PAT" in the top-left corner
- Name it something that describes its purpose, i.e. "GitHub actions" or "Auto Description"
- Under scopes, find "Write Projects" and make sure it's checked
- Give it an expiration date -- Once this expiration date is reached, you'll need to generate a new token.
- This is to ensure security. Anybody with this token could do harm to your project(s).
- Press "Create PAT"
- The PAT you just created should appear with some random numbers and letters, copy that
- Put it in a GitHub Secret
- You're done!
Required
This is the URL, slug, or id of the Modrinth project.
Optional, default = README.md
The path to the readme to fetch from the root of the GitHub repo.
on:
push:
branches: [ main ]
jobs:
modrinth-desc:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- uses: funnyboy-roks/[email protected]
with:
auth-token: ${{ secrets.MODRINTH_AUTH_TOKEN }}
slug: 'mapify'