GitHub action
Learn how to use the Stringtale GitHub Action in your workflow for text updates..
What does it do?
The Stringtale GitHub Action automatically creates Pull Requests in your GitHub repository with the latest text updates stored in Stringtale.
Why use it?
The GitHub action automates the process of implementing text changes that have made by you or your client. Your team will gets notified automatically of new Pull Requests, allowing you to see if there is an update without having to check manually.
With our GitHub action you still have full control if you want to run Stringtale on every push on every branch, or if you want to limit this to just release branches.
How do I use it?
There are two ways to trigger the GitHub action. You can either use the various triggers that GitHub has to offer (for example when pushing to a branch), or by letting Stringtale call a webhook whenever text updates are made. Both will then in turn create a pull request with the latest text changes.
Pushing to a branch
Below is an example of how to set up a GitHub action to run Stringtale on every push to any branch in your repository, including an example yaml file for the workflow.
- Navigate to the Stringtale Dashboard and obtain yourself an API key.
- Go to your GitHub repository => Settings => Environments.
- Add the Token you obtained from the dashboard as
STRINGTALE_API_KEY
to the required environment(s) or create a new one. - Create a
stringtale.yaml
file in the.github/workflows
folder in the root of your project. For example<PROJECT_DIRECTORY>/.github/workflows/stringtale.yaml
. - Use the example YAML file from below and adjust to your project’s needs.
- The next time this workflow gets triggered Stringtale will automatically create a Pull Request with any pending changes to the branch that triggered it.
Example yaml for GitHub actions
The example yaml file below will enable Stringtale to run on all branches on all pushes. If you prefer a different workflow, please refer to the GitHub Actions documentation.
Using Stringtale webhooks
Alternatively to having Github trigger the workflow, you can also set up a webhook to trigger the GitHub action instead. This however has the limitation that it only works for the main branch. This is a limitation of GitHub Actions. So if you want to run Stringtale on other branches, you will need to use the GitHub action.
- Follow the steps above to set up the GitHub action for pushes, but replace the section
on: push:
withon: repository_dispatch:
as follows: - Navigate to the Stringtale Dashboard.
- Go to Projects.
- Open the project (or click on Edit project settings) you wnat to enable webhooks for.
- Scroll down to
Webhooks
and click onAdd Webhook
. - For type select ‘GitHub’ and for the URL enter
https://api.github.com/repos/{owner}/{repository}/dispatches
, replacing{owner}
with the name of the owner of the repository (typically your organization) and{repository}
with the name of the repository as they’d normally appear in the URL when you navigate to the repository on GitHub. For more information see the GitHub documentation on webhook events and payloads. - From now on whenever somebody presses ‘Save changes’ in Stringtale, a webhook will automatically be fired to trigger the GitHub action.