- use macOS 12 or Ubuntu 22.04 wherever appropriate - don't append `(Linux)` to job names - use specific Ubuntu 22.04 and Ubuntu 18.04 jobs We may want to consider more Ubuntu 18.04 jobs in future, too.
77 lines
2.4 KiB
YAML
77 lines
2.4 KiB
YAML
name: Vendor Gems
|
|
|
|
on:
|
|
pull_request_target:
|
|
workflow_dispatch:
|
|
inputs:
|
|
pull_request:
|
|
description: Pull request number
|
|
required: true
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
jobs:
|
|
vendor-gems:
|
|
if: >
|
|
startsWith(github.repository, 'Homebrew/') && (
|
|
github.event_name == 'workflow_dispatch' || (
|
|
github.event.pull_request.user.login == 'dependabot[bot]' &&
|
|
contains(github.event.pull_request.title, '/Library/Homebrew')
|
|
)
|
|
)
|
|
runs-on: macos-12
|
|
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 commit signing
|
|
uses: Homebrew/actions/setup-commit-signing@master
|
|
with:
|
|
signing_key: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY }}
|
|
|
|
- name: Check out pull request
|
|
id: checkout
|
|
run: |
|
|
gh pr checkout '${{ github.event.pull_request.number || github.event.inputs.pull_request }}'
|
|
|
|
branch="$(git branch --show-current)"
|
|
echo "::set-output name=branch::${branch}"
|
|
|
|
gem_name="$(echo "${branch}" | sed -E 's|.*/||;s|(.*)-.*$|\1|')"
|
|
echo "::set-output name=gem_name::${gem_name}"
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Vendor Gems
|
|
env:
|
|
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
|
|
run: brew vendor-gems
|
|
|
|
- name: Update RBI files
|
|
env:
|
|
GEM_NAME: ${{ steps.checkout.outputs.gem_name }}
|
|
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
|
|
run: |
|
|
brew typecheck --update
|
|
if ! git diff --stat --exit-code "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet"
|
|
then
|
|
git add "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet"
|
|
git commit -m "Update RBI files for ${GEM_NAME}." \
|
|
-m "Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gemss.yml) workflow."
|
|
fi
|
|
|
|
- name: Push to pull request
|
|
uses: Homebrew/actions/git-try-push@master
|
|
with:
|
|
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
|
|
branch: ${{ steps.checkout.outputs.branch }}
|
|
force: true
|