Scheduled database updates #885
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: Scheduled database updates | |
on: | |
push: | |
branches: | |
- master | |
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@main | |
with: | |
fetch-depth: 0 | |
ref: master | |
path: repo | |
- name: Update database | |
working-directory: repo | |
env: | |
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }} | |
run: | | |
if [[ -n "${{ github.event.inputs.max-downloads }}" ]] | |
then | |
MAX_DOWNLOADS_ARGS="--max-downloads ${{ github.event.inputs.max-downloads }}" | |
fi | |
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 | |
with: | |
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} | |
directory: repo |