summaryrefslogtreecommitdiffstats
path: root/.github/workflows/update-license-file.yml
blob: 2ccfe663622bc1d441f5fc2894d8e7d59db949a1 (plain)
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
name: Update LICENSE file

on:
  push:
    branches:
      - master
      - walnascar
      - styhead
      - scarthgap
      - nanbield
      - mickledore
      - kirkstone
      - honister
      - hardknott
      - gatesgarth
      - dunfell
    paths:
      - "**/*.bb"
      - "**/*.inc"
  schedule:
    - cron: "0 0 * * *" # Runs daily at midnight
  workflow_dispatch: # Allows manual run

jobs:
  update-license:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Run license generation script
        run: |
          ./scripts/generate-license-file

      - name: Commit and push LICENSE file
        run: |
          git config --local user.name "github-actions[bot]"
          git config --local user.email "github-actions[bot]@users.noreply.github.com"
          git add LICENSE
          if ! git diff-index --quiet HEAD; then
            git commit -m "Auto-update LICENSE file with current recipe licenses"
            git push
          fi

        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}