Skip to content

Scheduled database updates #1396

Scheduled database updates

Scheduled database updates #1396

name: Scheduled database updates
on:
push:
paths:
- .github/workflows/update-database.yml
schedule:
# Once every day at midnight UTC
- cron: "0 0 * * *"
workflow_dispatch:
inputs:
max-downloads:
description: Maximum number of formulae to download when updating
required: false
jobs:
update-database:
if: startsWith( github.repository, 'Homebrew/' )
runs-on: macos-latest
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 repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
ref: master
path: repo
- name: Update database
working-directory: repo
env:
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
MAX_DOWNLOADS: ${{ github.event.inputs.max-downloads }}
run: |
set -eo pipefail
if [[ -n "$MAX_DOWNLOADS" ]]
then
MAX_DOWNLOADS_ARGS="--max-downloads $MAX_DOWNLOADS"
fi
# Need to intentionally leave MAX_DOWNLOADS_ARGS unquoted.
# shellcheck disable=SC2086
brew which-update --commit --update-existing --install-missing $MAX_DOWNLOADS_ARGS executables.txt
- name: Output database stats
working-directory: repo
run: brew which-update --stats executables.txt
- name: Push commits
uses: Homebrew/actions/git-try-push@master
if: github.ref == 'refs/heads/master'
with:
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
directory: repo