A GitHub action to create a PR to upgrade your Bullet Train application from the starter repo.
When used in a workflow this action will:
- Checkout your application code.
- Configure the starter repo as the
bullet-train
remote - Merge in the tag for the version number that was passed in. (Merges the latest version if no version is passed.)
- Create a Pull Request containing the changes required for the upgrade. If there are merge conflicts they will be included in the PR and you'll need to resolve them.
- name: Create upgrade PR
uses: bullet-train-co/create-upgrade-pr@v1
For this action to work you must explicitly allow GitHub Actions to create pull requests. This setting can be found in a repository's settings under Actions > General > Workflow permissions.
For repositories belonging to an organization, this setting can be managed by admins in organization settings under Actions > General > Workflow permissions.
Name | Description | Default |
---|---|---|
token |
GITHUB_TOKEN (permissions contents: write and pull-requests: write ) or a repo scoped Personal Access Token (PAT). |
GITHUB_TOKEN |
versionNumber |
The version that you want to upgrade to. | If not supplied we'll used the latest published version. |
If you have any workflows set up that are triggered when a PR is created you'll want to setup a Personal Access Token and pass that in.
This is due to a limitation on the default GITHUB_TOKEN
which is unable to trigger additional workflows.
NOTE:
When you use a PAT the resulting PR will show as being opened by the owner of the PAT, not by the person who ran the action.
If you do not use a PAT then the PR will show as being opened by github-actions (bot)
. (But workflows will not run, as mentioned above.)
When creating a Personal Access Token (PAT) you have two choices.
- Use the new "Fine-grained tokens" when creating your token. You'll need to select the appropriate repo(s), and set "Contents" and "Pull Request" permissions to be read/write.
- Create a "classic" token with the
repo
scope. This token will have access to ALL your repos, so we don't really recommend it.
Once you've generated your token add it to your repository secretes as PAT
.
Here's a screenshot of setting up a fine-grained token:
None
TODO: Maybe we should output some things?
Here is a complete example worklow. In fact, this is exactly the workflow that we ship in the starter repo.
name: "Create Bullet Train Upgrade PR"
on:
workflow_dispatch:
inputs:
versionNumber:
description: 'Version Number (latest if blank)'
type: string
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Create upgrade PR
uses: bullet-train-co/create-upgrade-pr@v1
with:
versionNumber: ${{ inputs.versionNumber }}
token: ${{ secrets.PAT }}