Improve sorbet & vendor gem workflow testing
This commit is contained in:
parent
0a23ee2466
commit
496736a199
23
.github/workflows/sorbet.yml
vendored
23
.github/workflows/sorbet.yml
vendored
@ -1,6 +1,11 @@
|
|||||||
name: Update Sorbet files
|
name: Update Sorbet files
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- Library/Homebrew/dev-cmd/typecheck.rb
|
||||||
|
- Library/Homebrew/sorbet/**
|
||||||
|
- "!Library/Homebrew/sorbet/rbi/**"
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- .github/workflows/sorbet.yml
|
- .github/workflows/sorbet.yml
|
||||||
@ -23,20 +28,19 @@ jobs:
|
|||||||
uses: Homebrew/actions/setup-homebrew@master
|
uses: Homebrew/actions/setup-homebrew@master
|
||||||
|
|
||||||
- name: Configure Git user
|
- name: Configure Git user
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
uses: Homebrew/actions/git-user-config@master
|
uses: Homebrew/actions/git-user-config@master
|
||||||
with:
|
with:
|
||||||
username: BrewTestBot
|
username: BrewTestBot
|
||||||
|
|
||||||
- name: Set up commit signing
|
- name: Set up commit signing
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
uses: Homebrew/actions/setup-commit-signing@master
|
uses: Homebrew/actions/setup-commit-signing@master
|
||||||
with:
|
with:
|
||||||
signing_key: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY }}
|
signing_key: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY }}
|
||||||
|
|
||||||
- name: Update RBI files
|
- name: Update RBI files
|
||||||
id: update
|
id: update
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
|
|
||||||
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
|
|
||||||
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
|
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
|
||||||
run: |
|
run: |
|
||||||
git fetch origin
|
git fetch origin
|
||||||
@ -53,6 +57,15 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
brew typecheck --update --suggest-typed
|
brew typecheck --update --suggest-typed
|
||||||
|
|
||||||
|
- name: Commit changes
|
||||||
|
id: commit
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
|
||||||
|
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
|
||||||
|
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
|
||||||
|
run: |
|
||||||
if ! git diff --stat --exit-code "Library/Homebrew/sorbet"
|
if ! git diff --stat --exit-code "Library/Homebrew/sorbet"
|
||||||
then
|
then
|
||||||
git add "Library/Homebrew/sorbet"
|
git add "Library/Homebrew/sorbet"
|
||||||
@ -75,7 +88,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Push commits
|
- name: Push commits
|
||||||
if: steps.update.outputs.committed == 'true'
|
if: steps.commit.outputs.committed == 'true'
|
||||||
uses: Homebrew/actions/git-try-push@master
|
uses: Homebrew/actions/git-try-push@master
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
|
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
|
||||||
@ -85,7 +98,7 @@ jobs:
|
|||||||
origin_branch: "master"
|
origin_branch: "master"
|
||||||
|
|
||||||
- name: Open a pull request
|
- name: Open a pull request
|
||||||
if: steps.update.outputs.pull_request == 'true'
|
if: steps.commit.outputs.pull_request == 'true'
|
||||||
run: hub pull-request --no-edit
|
run: hub pull-request --no-edit
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
|
||||||
|
|||||||
32
.github/workflows/vendor-gems.yml
vendored
32
.github/workflows/vendor-gems.yml
vendored
@ -1,6 +1,15 @@
|
|||||||
name: Vendor Gems
|
name: Vendor Gems
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- Library/Homebrew/dev-cmd/vendor-gems.rb
|
||||||
|
- Library/Homebrew/Gemfile*
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- .github/workflows/vendor-gems.yml
|
||||||
|
branches-ignore:
|
||||||
|
- master
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
@ -15,8 +24,10 @@ permissions:
|
|||||||
jobs:
|
jobs:
|
||||||
vendor-gems:
|
vendor-gems:
|
||||||
if: >
|
if: >
|
||||||
startsWith(github.repository, 'Homebrew/') && (
|
github.repository_owner == 'Homebrew' && (
|
||||||
github.event_name == 'workflow_dispatch' || (
|
github.event_name == 'workflow_dispatch' ||
|
||||||
|
github.event_name == 'pull_request' ||
|
||||||
|
github.event_name == 'push' || (
|
||||||
github.event.pull_request.user.login == 'dependabot[bot]' &&
|
github.event.pull_request.user.login == 'dependabot[bot]' &&
|
||||||
contains(github.event.pull_request.title, '/Library/Homebrew')
|
contains(github.event.pull_request.title, '/Library/Homebrew')
|
||||||
)
|
)
|
||||||
@ -28,17 +39,20 @@ jobs:
|
|||||||
uses: Homebrew/actions/setup-homebrew@master
|
uses: Homebrew/actions/setup-homebrew@master
|
||||||
|
|
||||||
- name: Configure Git user
|
- name: Configure Git user
|
||||||
|
if: github.event_name == 'pull_request_target' || github.event_name == 'workflow_dispatch'
|
||||||
uses: Homebrew/actions/git-user-config@master
|
uses: Homebrew/actions/git-user-config@master
|
||||||
with:
|
with:
|
||||||
username: BrewTestBot
|
username: BrewTestBot
|
||||||
|
|
||||||
- name: Set up commit signing
|
- name: Set up commit signing
|
||||||
|
if: github.event_name == 'pull_request_target' || github.event_name == 'workflow_dispatch'
|
||||||
uses: Homebrew/actions/setup-commit-signing@master
|
uses: Homebrew/actions/setup-commit-signing@master
|
||||||
with:
|
with:
|
||||||
signing_key: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY }}
|
signing_key: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY }}
|
||||||
|
|
||||||
- name: Check out pull request
|
- name: Check out pull request
|
||||||
id: checkout
|
id: checkout
|
||||||
|
if: github.event_name == 'pull_request_target' || github.event_name == 'workflow_dispatch'
|
||||||
run: |
|
run: |
|
||||||
gh pr checkout '${{ github.event.pull_request.number || github.event.inputs.pull_request }}'
|
gh pr checkout '${{ github.event.pull_request.number || github.event.inputs.pull_request }}'
|
||||||
|
|
||||||
@ -54,15 +68,24 @@ jobs:
|
|||||||
- name: Vendor Gems
|
- name: Vendor Gems
|
||||||
env:
|
env:
|
||||||
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
|
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
|
||||||
run: brew vendor-gems
|
run: |
|
||||||
|
if [[ "${GITHUB_EVENT_NAME}" == "pull_request_target" || "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]
|
||||||
|
then
|
||||||
|
brew vendor-gems
|
||||||
|
else
|
||||||
|
brew vendor-gems --no-commit
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Update RBI files
|
- name: Update RBI files
|
||||||
|
run: brew typecheck --update
|
||||||
|
|
||||||
|
- name: Commit RBI changes
|
||||||
|
if: github.event_name == 'pull_request_target' || github.event_name == 'workflow_dispatch'
|
||||||
env:
|
env:
|
||||||
GEM_NAME: ${{ steps.checkout.outputs.gem_name }}
|
GEM_NAME: ${{ steps.checkout.outputs.gem_name }}
|
||||||
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
|
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
|
||||||
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
|
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
|
||||||
run: |
|
run: |
|
||||||
brew typecheck --update
|
|
||||||
if ! git diff --stat --exit-code "Library/Homebrew/sorbet"
|
if ! git diff --stat --exit-code "Library/Homebrew/sorbet"
|
||||||
then
|
then
|
||||||
git add "Library/Homebrew/sorbet"
|
git add "Library/Homebrew/sorbet"
|
||||||
@ -71,6 +94,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Push to pull request
|
- name: Push to pull request
|
||||||
|
if: github.event_name == 'pull_request_target' || github.event_name == 'workflow_dispatch'
|
||||||
uses: Homebrew/actions/git-try-push@master
|
uses: Homebrew/actions/git-try-push@master
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
|
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user