diff --git a/.github/workflows/tapioca-update.yml b/.github/workflows/tapioca-update.yml new file mode 100644 index 0000000000000..2a9b482624b50 --- /dev/null +++ b/.github/workflows/tapioca-update.yml @@ -0,0 +1,57 @@ +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')"