-
-
Notifications
You must be signed in to change notification settings - Fork 2
53 lines (50 loc) · 1.6 KB
/
update-formula.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
name: Update a formula
on:
workflow_dispatch:
inputs:
subject:
description: which formula to update?
required: true
type: choice
options:
- cli
- gomod
version:
description: which version shall be published
required: true
type: string
permissions:
contents: write # push commits
pull-requests: write # create pullrequests
jobs:
update:
name: "update formula: ${{ github.event.inputs.subject }} ${{ github.event.inputs.version }}"
runs-on: ubuntu-latest
timeout-minutes: 10
env:
UF_SUBJECT: ${{ github.event.inputs.subject }}
UF_VERSION: ${{ github.event.inputs.version }}
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v4
- name: Update Formula
run: >
.github/scripts/update-formula/"${UF_SUBJECT}"/gen.sh
"${UF_VERSION}"
> Formula/cyclonedx-"${UF_SUBJECT}".rb
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit & Push
run: |
BRANCH_NAME="update-formula/${UF_SUBJECT}-${UF_VERSION}"
git checkout -B "$BRANCH_NAME"
git add -A Formula
git config user.name "[BOT] Formula Updater"
git config user.email "[email protected]"
git commit -s -m "Update ${UF_SUBJECT}: ${UF_VERSION}"
git push -f --set-upstream origin "$BRANCH_NAME"
- name: Open PullRequest
run: gh pr create --fill-verbose --label "$UF_SUBJECT"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}