forked from Homebrew/homebrew-cask
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (78 loc) · 2.84 KB
/
remove-disabled-packages.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Remove disabled packages
on:
push:
branches:
- master
paths:
- .github/workflows/remove-disabled-packages.yml
schedule:
# Once every day at midnight UTC
- cron: "0 0 * * *"
workflow_dispatch:
concurrency:
group: remove-disabled-packages
cancel-in-progress: true
permissions:
contents: read
jobs:
remove-disabled-packages:
if: github.repository_owner == 'Homebrew'
runs-on: macos-latest
env:
REMOVAL_BRANCH: remove-disabled-packages
permissions:
contents: write # for Homebrew/actions/git-try-push
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: false
cask: true
test-bot: false
- name: Configure Git user
id: git-user-config
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: Checkout removal branch
run: git checkout -b "$REMOVAL_BRANCH" origin/master
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
- name: Remove disabled packages
id: remove_disabled
uses: Homebrew/actions/remove-disabled-packages@master
env:
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
HOMEBREW_EVAL_ALL: 1
HOMEBREW_NO_INSTALL_FROM_API: 1
- name: Push commits
if: fromJson(steps.remove_disabled.outputs.packages-removed)
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
branch: ${{ env.REMOVAL_BRANCH }}
env:
GIT_COMMITTER_NAME: ${{ steps.git-user-config.outputs.name }}
GIT_COMMITTER_EMAIL: ${{ steps.git-user-config.outputs.email }}
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
- name: Create pull request
id: pr-create
if: fromJson(steps.remove_disabled.outputs.packages-removed)
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
env:
GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
PR_BODY: >
This pull request was created automatically by the
[`remove-disabled-packages`](https://github.com/Homebrew/homebrew-cask/blob/HEAD/.github/workflows/remove-disabled-packages.yml)
workflow.
run: |
gh pr create \
--base master \
--body "$PR_BODY" \
--head "$REMOVAL_BRANCH" \
--title 'Remove disabled packages'