Autobump #711
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Autobump | |
on: | |
push: | |
# Run every day at 8:00 AM | |
schedule: | |
- cron: '0 8 * * *' | |
workflow_dispatch: | |
env: | |
HOMEBREW_FORCE_HOMEBREW_ON_LINUX: 1 | |
jobs: | |
autobump: | |
if: github.repository == 'fwcd/homebrew-fwcd' | |
runs-on: macos-latest | |
steps: | |
- name: Set up Homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Install dependencies | |
run: brew install jq | |
- name: Set up Git user | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Bump casks | |
run: | | |
set -e | |
cd "$(brew --repo fwcd/fwcd)" | |
for cask_path in Casks/*; do | |
cask_file="${cask_path##*/}" | |
cask="${cask_file%.*}" | |
echo "==> Checking $cask..." | |
status_json=`brew livecheck --json $cask` | |
echo "Status: $status_json" | |
if jq -e '.[0].version.outdated' <<< "$status_json" >/dev/null; then | |
latest_version=`jq -r '.[0].version.latest' <<< "$status_json"` | |
echo "==> Bumping outdated $cask to $latest_version..." | |
brew bump-cask-pr --write-only --commit --version "$latest_version" $cask | |
fi | |
done | |
shell: bash | |
env: | |
HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }} | |
- name: Push changes | |
if: github.ref == 'refs/heads/main' | |
run: | | |
set -e | |
cd "$(brew --repo fwcd/fwcd)" | |
git push "https://${{ github.actor }}:${{ github.token }}@github.com/fwcd/homebrew-fwcd.git" |