Skip to content
Snippets Groups Projects
Unverified Commit 982c7ada authored by vidusheeamoli's avatar vidusheeamoli Committed by Mike McQuaid
Browse files

.github/workflows: add action to update tapioca definitions

- Tapioca is a companion gem to Sorbet that generates RBI files for the
  Ruby gems in a project.
- Whenever Dependabot updates a gem, Tapioca has to regenerate that gem's
  RBI files so that Sorbet can accurately assess the state of the typing
  of a codebase.
- We also must regenerate Sorbet's view of
  [things defined at runtime](https://sorbet.org/docs/rbi#the-hidden-definition-rbi

):
  this is what it calls `hidden-definitions`.
- Obviously, this got tedious to do manually. So here's an Action that
  runs every three days and raises a PR if there are any changes.

Co-authored-by: default avatarVidushee Amoli <vidushee.amoli@gmail.com>
Co-authored-by: default avatarIssy Long <me@issyl0.co.uk>
Co-authored-by: default avatarJonathan Chang <jchang641@gmail.com>
Co-authored-by: default avatarMike McQuaid <mike@mikemcquaid.com>
parent 14ec695c
No related branches found
No related tags found
No related merge requests found
name: Tapioca Update
on:
push:
paths:
- .github/workflows/tapioca-update.yml
schedule:
- cron: '0 0 */3 * *' # every three days
env:
HOMEBREW_SORBET: 1
jobs:
update-tapioca:
if: github.repository == 'Homebrew/brew'
runs-on: ubuntu-latest
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Configure Git user
uses: Homebrew/actions/git-user-config@master
with:
username: BrewTestBot
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.3
- name: Update Tapioca Definitions
run: |
cd "$GITHUB_WORKSPACE/Library/Homebrew"
bundle install
bundle exec tapioca sync --exclude json
bundle exec srb rbi hidden-definitions
if ! git diff --exit-code -- sorbet; then
BRANCH="tapioca-update"
if ! git ls-remote --exit-code --heads origin "$BRANCH"; then
git checkout -b "$BRANCH"
git commit -am "sorbet: Update gem RBI files using Tapioca
Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/actions?query=workflow%3A%22Tapioca+Update%22)."
fi
fi
- name: Push commits
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: tapioca-update
directory: Library/Homebrew/
- name: Open a PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd "$GITHUB_WORKSPACE/Library/Homebrew"
hub pull-request -m "$(git log -1 --format='%s')"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment