70 %

Toast is in Beta!Learn more →

Chris Biscardi

Integrating Bors with GitHub Actions

What is Bors?

If you're unfamiliar with Bors, check out this post for a short primer.

You will also need to sign up for app.bors.tech to follow along here. Do this and give the Bors service permission to access at least the repo you're using to test with.

Setting up Bors with GitHub Actions

Here's a GitHub Action that uses nightly Rust to run cargo check. There are two important parts of this workflow.

  1. That the branches it operates on are branches Bors controls: staging and trying. We never push to these branches manually. We only submit PRs.
  2. The name of the job. In this case I've named my job Bors because I only have one that I care about, but you can have many.
.github/workflows/bors.yml
yaml
name: Bors Runs
on:
push:
branches:
- staging
- trying
jobs:
test:
name: Bors
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustfmt, clippy
- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check

Secondarily, we need a bors.toml in the root of our project. This toml file will include any config we want to use. In this case, it specifies which Job statuses to pay attention to for merging purposes. We've specified the name here that matches the job we care about in our GitHub Action above.

bors.toml
toml
status = ["Bors"]

That's it, now you can bors r+ to your heart's content.

More

If you're working in the JS ecosystem, you'll want to pair the Bors workflow with Changesets to manage npm semver releases via PR as well.