-
-
Notifications
You must be signed in to change notification settings - Fork 48
67 lines (58 loc) · 1.95 KB
/
update-database.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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@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 }}
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