65 lines
2.1 KiB
YAML
65 lines
2.1 KiB
YAML
name: Update Tapioca definitions
|
|
on:
|
|
push:
|
|
paths:
|
|
- .github/workflows/tapioca.yml
|
|
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: |
|
|
cd "$GITHUB_WORKSPACE/Library/Homebrew"
|
|
|
|
# TODO: replace with `brew typecheck`
|
|
bundle exec tapioca sync --exclude json
|
|
bundle exec srb rbi hidden-definitions
|
|
|
|
git fetch origin master
|
|
git reset --hard origin/master
|
|
git checkout -B tapioca-update
|
|
git add sorbet
|
|
if ! git diff --no-patch --exit-code HEAD -- sorbet; then
|
|
if ! git ls-remote --exit-code --heads origin tapioca-update >/dev/null; then
|
|
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"
|
|
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 }}
|
|
branch: tapioca-update
|
|
|
|
- name: Open a pull request
|
|
if: steps.update.outputs.committed == 'true'
|
|
run: hub pull-request --no-edit
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
|