.github/workflows: various fixes.

- don't try to `brew update-sponsors`, @BrewTestBot doesn't have
  `admin:org` rights, nor should they
- allow testing the `maintainers-man-completions` workflow on branches
- cache RubyGems for `brew generate-man-completions`
- add `workflow_dispatch` support to `spdx` workflow for easier testing
This commit is contained in:
Mike McQuaid 2022-09-05 13:27:50 +01:00
parent 552dc93242
commit 56cca1edd3
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829
2 changed files with 22 additions and 16 deletions

View File

@ -1,9 +1,9 @@
name: Update sponsors, maintainers, manpage and completions
name: Update maintainers, manpage and completions
on:
push:
paths:
- .github/workflows/sponsors-maintainers-man-completions.yml
- .github/workflows/maintainers-man-completions.yml
- README.md
- Library/Homebrew/cmd/**
- Library/Homebrew/dev-cmd/**
@ -12,8 +12,6 @@ on:
- Library/Homebrew/cli/parser.rb
- Library/Homebrew/completions.rb
- Library/Homebrew/env_config.rb
branches:
- master
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
@ -27,6 +25,7 @@ jobs:
if: github.repository == 'Homebrew/brew'
steps:
- name: Setup Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Configure Git user
@ -39,12 +38,24 @@ jobs:
with:
signing_key: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY }}
- name: Update sponsors, maintainers, manpage and completions
- name: Cache Bundler RubyGems
uses: actions/cache@v1
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
restore-keys: ${{ runner.os }}-rubygems-
- name: Update maintainers, manpage and completions
id: update
run: |
git fetch origin
BRANCH=sponsors-maintainers-man-completions
if [[ -n "$GITHUB_REF_NAME" && "$GITHUB_REF_NAME" != "master" ]]
then
BRANCH="$GITHUB_REF_NAME"
else
BRANCH=maintainers-man-completions
fi
echo "::set-output name=branch::${BRANCH}"
if git ls-remote --exit-code --heads origin "${BRANCH}"
@ -64,15 +75,7 @@ jobs:
"${GITHUB_WORKSPACE}/docs/Manpage.md" \
"${GITHUB_WORKSPACE}/manpages/brew.1"
git commit -m "Update maintainers." \
-m "Autogenerated by the [update-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow."
COMMITTED=true
fi
if brew update-sponsors
then
git add "${GITHUB_WORKSPACE}/README.md"
git commit -m "Update sponsors." \
-m "Autogenerated by the [update-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow."
-m "Autogenerated by the [update-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/maintainers-man-completions.yml) workflow."
COMMITTED=true
fi
@ -83,7 +86,7 @@ jobs:
"${GITHUB_WORKSPACE}/manpages/brew.1" \
"${GITHUB_WORKSPACE}/completions"
git commit -m "Update manpage and completions." \
-m "Autogenerated by the [update-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow."
-m "Autogenerated by the [update-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/maintainers-man-completions.yml) workflow."
COMMITTED=true
fi

View File

@ -7,8 +7,11 @@ on:
- master
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
permissions:
contents: read
jobs:
spdx:
if: github.repository == 'Homebrew/brew'