-
Notifications
You must be signed in to change notification settings - Fork 12
Setting Up Dynacover with GitHub Actions
In this page you'll find a step-by-step guide on how to set up Dynacover to run with GitHub actions. Before getting started, make sure you have the following information available:
- A registered application on dev.twitter.com with read and write access. Obtain the following 4 tokens from the application settings page:
- Consumer / API Token (App token)
- Consumer / API Secret (App secret)
- Access Key (User token)
- Access Secret (User secret)
- Optional: a GitHub personal access token, only required if you want to showcase GitHub sponsors on your Twitter header.
For more information, check this tutorial.
Start by creating a new empty GitHub repository, where you're going to set up the Dynacover workflow. Later on, you will be able to customize your header by committing a custom template / images to this repository.
To speed things up, mark the checkbox to include a README file, that way a main
branch will be automatically created and the repository will be ready to be cloned if you want to (not necessary for this guide, however - we'll use only the GitHub web UI).
Next, you'll need to set up your API keys. Go to Settings -> Secrets:
Then, click on the New repository secret button on the top right.
You'll need to add the following secrets:
-
DYNA_TWITTER_KEY
: your Twitter application consumer key or App Key. -
DYNA_TWITTER_SECRET
: your Twitter application consumer secret or App Secret. -
DYNA_TWITTER_TOKEN
: your personal user token. -
DYNA_TWITTER_TOKEN_SECRET
: your personal user token secret. -
DYNA_GITHUB_TOKEN
(optional): your GitHub personal token (for pulling GitHub Sponsors).
Once the secrets are set, you can create your workflow.
Next, go to Actions and click on the link that says set up a workflow yourself.
Rename the file to dynacover.yml
and replace the boilerplate content with the following workflow, which will run Dynacover using default options every hour:
name: Update Twitter Header Image with Dynacover
on:
schedule:
- cron: "0 * * * *"
workflow_dispatch:
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
path: 'dynacover_custom'
- name: 'Update Dynacover image and upload to Twitter'
uses: erikaheidi/dynacover-actions@v4.2
env:
# Uncomment and change accordingly to customize your cover
#DYNA_DEFAULT_TEMPLATE: dynacover.json
#DYNA_TEMPLATES_DIR: ${{ github.workspace }}/dynacover_custom
#DYNA_IMAGES_DIR: ${{ github.workspace }}/dynacover_custom
DYNA_TWITTER_KEY: ${{ secrets.DYNA_TWITTER_KEY }}
DYNA_TWITTER_SECRET: ${{ secrets.DYNA_TWITTER_SECRET }}
DYNA_TWITTER_TOKEN: ${{ secrets.DYNA_TWITTER_TOKEN }}
DYNA_TWITTER_TOKEN_SECRET: ${{ secrets.DYNA_TWITTER_TOKEN_SECRET }}
DYNA_GITHUB_TOKEN: ${{ secrets.DYNA_GITHUB_TOKEN }}
Once you're finished you can commit the file to the repository, and the workflow will be enabled.
Access the Actions
tab of the repository where you've set up this workflow, select the Dynacover workflow on the left menu, and then click on the Run workflow
button on the right to manually trigger the action.
Once the the action has finished running, check your Twitter profile to see if the header image was updated successfully.