-
Mike McQuaid authoredMike McQuaid authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
tapioca.yml 2.49 KiB
name: Update Tapioca definitions
on:
push:
paths:
- .github/workflows/tapioca.yml
branches-ignore:
- master
schedule:
- cron: '0 */12 * * *'
jobs:
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
# TODO: remove with `brew typecheck`
- name: Set up Ruby
uses: actions/setup-ruby@main
with:
ruby-version: '2.6'
- name: Install RubyGems
run: |
cd "$GITHUB_WORKSPACE/Library/Homebrew"
gem install bundler -v "~>1"
bundle install --jobs 4 --retry 3
- name: Update Tapioca definitions
id: update
run: |
git fetch origin
BRANCH="tapioca-update"
echo "::set-output name=branch::${BRANCH}"
if git ls-remote --exit-code --heads origin "$BRANCH"; then
git checkout "$BRANCH"
git reset origin/master
else
git checkout -B "$BRANCH" origin/master
BRANCH_EXISTS="1"
fi
# TODO: replace with `brew typecheck`
cd "$GITHUB_WORKSPACE/Library/Homebrew"
bundle exec tapioca sync --exclude json
bundle exec srb rbi hidden-definitions
if ! git diff --no-patch --exit-code -- sorbet; then
# if brew typecheck --update --fail-if-not-changed; then
git add "$GITHUB_WORKSPACE/Library/Homebrew/sorbet"
git commit -m "sorbet: update RBI files using Tapioca." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/tapioca.yml)."
echo "::set-output name=committed::true"
if [ -n "$BRANCH_EXISTS" ]; then
echo "::set-output name=pull_request::true"
fi
fi
- name: Push commits
if: steps.update.outputs.committed == 'true'
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}