- Ensure `spdx.yml` has same fixes as `tapioca.yml`. - Don't `reset --hard` to ensure that `brew` commands used are those in the same branch rather than always from `origin/master` - Don't check for an existing branch but instead force-push to it if there's any updates. - Provide sample `brew typecheck` command that can be used.
51 lines
1.6 KiB
YAML
51 lines
1.6 KiB
YAML
name: Update SPDX license data
|
|
on:
|
|
push:
|
|
paths:
|
|
- .github/workflows/spdx.yml
|
|
schedule:
|
|
- cron: '0 */12 * * *'
|
|
jobs:
|
|
spdx:
|
|
if: github.repository == 'Homebrew/brew'
|
|
runs-on: ubuntu-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: Update SPDX license data
|
|
id: update
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
git fetch origin master
|
|
git reset origin/master
|
|
git checkout -B spdx-update
|
|
|
|
if brew update-license-data --fail-if-not-changed; then
|
|
git add "$GITHUB_WORKSPACE/Library/Homebrew/data/spdx"
|
|
git commit -m "spdx: update license data." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/spdx.yml)."
|
|
echo "::set-output name=committed::true"
|
|
fi
|
|
|
|
- name: Push commits
|
|
if: steps.update.outputs.committed == 'true'
|
|
uses: Homebrew/actions/git-try-push@master
|
|
with:
|
|
token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
|
|
branch: spdx-update
|
|
force: true
|
|
|
|
- name: Open a pull request
|
|
if: steps.update.outputs.committed == 'true'
|
|
run: hub pull-request --no-edit
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
|