From dc56b53392cc005e282b470d03364b66f41808a5 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Sat, 22 Aug 2020 00:21:50 +0200 Subject: [PATCH 1/3] workflows: add missing git subcommand --- .github/workflows/tapioca.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tapioca.yml b/.github/workflows/tapioca.yml index f883c94c53..6583afbab4 100644 --- a/.github/workflows/tapioca.yml +++ b/.github/workflows/tapioca.yml @@ -42,7 +42,7 @@ jobs: git checkout -B tapioca-update git reset origin/master git add sorbet - if ! git --no-patch --exit-code HEAD -- sorbet; then + if ! git diff --no-patch --exit-code HEAD -- sorbet; then if ! git ls-remote --exit-code --heads origin tapioca-update; 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" From e9b46b19673a8cffcdfd91542e990e027b0ddc9e Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sat, 22 Aug 2020 16:28:49 +0100 Subject: [PATCH 2/3] workflows/tapioca: Don't reset `tapioca-update` branch to `origin/master` - In all of the PRs that this Action triggered, the `tapioca-update` branch was >200 commits behind the latest `master`. - As per https://github.com/Homebrew/brew/pull/8435#issuecomment-678546024, we shouldn't rely on the `Homebrew/actions/setup-homebrew` master (the `origin/master` ref) branch being up to date, so resetting to `origin/master` was a bad idea. - A side effect of this is that when we raise PRs to change the Action, the PRs that it generates will include local commits. But functionally all we care about is the Action that runs on a schedule. --- .github/workflows/tapioca.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tapioca.yml b/.github/workflows/tapioca.yml index 6583afbab4..19be70f84f 100644 --- a/.github/workflows/tapioca.yml +++ b/.github/workflows/tapioca.yml @@ -40,10 +40,9 @@ jobs: bundle exec srb rbi hidden-definitions git checkout -B tapioca-update - git reset origin/master git add sorbet if ! git diff --no-patch --exit-code HEAD -- sorbet; then - if ! git ls-remote --exit-code --heads origin tapioca-update; 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 From dcc6e7c5147b2c3a7a9cfd68bbed8dc289e93c35 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Sat, 22 Aug 2020 18:03:27 +0200 Subject: [PATCH 3/3] workflows/tapioca: fetch origin/master and reset to it --- .github/workflows/tapioca.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tapioca.yml b/.github/workflows/tapioca.yml index 19be70f84f..9685d0b931 100644 --- a/.github/workflows/tapioca.yml +++ b/.github/workflows/tapioca.yml @@ -39,6 +39,8 @@ jobs: 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 @@ -57,8 +59,6 @@ jobs: - name: Open a pull request if: steps.update.outputs.committed == 'true' - run: | - cd "$GITHUB_WORKSPACE/Library/Homebrew" - hub pull-request --no-edit + run: hub pull-request --no-edit env: GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}