61 lines
1.9 KiB
YAML
61 lines
1.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
check_run:
|
|
types:
|
|
- created
|
|
- rerequested
|
|
|
|
jobs:
|
|
style:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- name: debug
|
|
run: |
|
|
echo "GITHUB_EVENT_NAME=${GITHUB_EVENT_NAME}"
|
|
echo "GITHUB_EVENT_PATH=${GITHUB_EVENT_PATH}"
|
|
|
|
cat "${GITHUB_EVENT_PATH}" | jq .
|
|
- name: brew pull
|
|
run: |
|
|
brew update-reset "$(brew --repository)"
|
|
|
|
HOMEBREW_INSTALL_BUNDLER_GEMS_FIRST=1 brew config
|
|
|
|
brew tap "${GITHUB_REPOSITORY}"
|
|
|
|
# Get latest version of `brew cask ci` command.
|
|
if [ "${GITHUB_REPOSITORY}" != Homebrew/homebrew-cask ]; then
|
|
brew update-reset "$(brew --repository homebrew/cask)"
|
|
fi
|
|
|
|
brew update-reset "$(brew --repository "${GITHUB_REPOSITORY}")"
|
|
|
|
case "${GITHUB_EVENT_NAME}" in
|
|
pull_request)
|
|
PR_URL="$(cat "${GITHUB_EVENT_PATH}" | jq -r .pull_request._links.html.href)"
|
|
;;
|
|
check_run)
|
|
PR_URL="$(brew ruby -e "puts GitHub.pull_requests('${GITHUB_REPOSITORY}', state: :open).detect { |pr| pr.dig('head', 'sha') == '$(cat "${GITHUB_EVENT_PATH}" | jq -r .check_run.head_sha)' }.dig('_links', 'html', 'href')")"
|
|
;;
|
|
esac
|
|
|
|
echo "PR_URL='${PR_URL}'"
|
|
|
|
brew pull --clean "${PR_URL}"
|
|
env:
|
|
HOMEBREW_COLOR: 1
|
|
HOMEBREW_DEVELOPER: 1
|
|
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: brew cask style
|
|
run: |
|
|
cd "$(brew --repository "${GITHUB_REPOSITORY}")"
|
|
export HOMEBREW_GITHUB_EVENT_NAME="${GITHUB_EVENT_NAME}"
|
|
export HOMEBREW_GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}"
|
|
brew cask ci --only-style --annotate-style-violations
|
|
env:
|
|
CI: true
|
|
HOMEBREW_COLOR: 1
|
|
HOMEBREW_DEVELOPER: 1
|
|
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|