Leverage bash and github actions to automate posting to dev.to
There is just a few steps to complete to get started.
This assumes you already have both a github account and adev.to account.
As a template repository
Use this template Get a dev.to API key Set it has DEVTO_API_KEY in your repository settings.
see here
An example workflow to automate cross-posting:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Create local changes
run: |
...
- name: update dev.to
uses: fennecdjay/devto.sh/@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
The script takes 2 arguments:
- the source of the blog
- the dev.to API_KEY
it will update (or create if necessary) any markdown file in the source directory.
When triggered (when you push), the action will run the script to update your dev.to account
the source directory is src
the markdown extension is .md
the API_KEY is named DEVTO_API_KEY