spdx.yml 1.1 KB
Newer Older
1
2
name: Update license data
on:
3
  push:
4
5
    paths:
      - .github/workflows/spdx.yml
6
  schedule:
Jonathan Chang's avatar
Jonathan Chang 已提交
7
    - cron: '0 */12 * * *'
8
9
jobs:
  spdx:
10
    if: github.repository == 'Homebrew/brew'
11
12
    runs-on: ubuntu-latest
    steps:
13
14
15
      - name: Set up Homebrew
        id: set-up-homebrew
        uses: Homebrew/actions/setup-homebrew@master
16

17
      - name: Configure Git user
18
19
20
21
22
23
24
25
26
27
28
        uses: Homebrew/actions/git-user-config@master
        with:
          username: BrewTestBot

      - name: Update license data
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          cd "$GITHUB_WORKSPACE/Library/Homebrew"
          if brew update-license-data --commit --fail-if-not-changed; then
29
            SPDX_VERSION=$(jq -er .licenseListVersion data/spdx/spdx_licenses.json)
30
31
32
33
34
35
            if ! git ls-remote --exit-code --heads origin "spdx-$SPDX_VERSION"; then
              git checkout -b "spdx-$SPDX_VERSION"
              git push origin "spdx-$SPDX_VERSION"
              hub pull-request -m "$(git log -1 --format='%s')"
            fi
          fi