diff options
| author | Otavio Salvador <otavio@ossystems.com.br> | 2025-04-01 14:50:15 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-01 14:50:15 -0300 |
| commit | 22bbe41834f6ec7e03b6b72de4810846fd6b24a6 (patch) | |
| tree | f0c20fe155b70c8c80c2341e46ce550d334f1326 | |
| parent | 66635782a4968cc9fcb58a07e1821cc910245a80 (diff) | |
| parent | f52917d5b90572044e7249aa754e61afb3e1aa67 (diff) | |
| download | meta-freescale-honister.tar.gz | |
Merge pull request #2174 from mdrodrigo/topic/honisterhonister
Add update-license-file in honister branch
| -rw-r--r-- | .github/workflows/update-license-file.yml | 47 | ||||
| -rwxr-xr-x | scripts/generate-license-file | 18 |
2 files changed, 65 insertions, 0 deletions
diff --git a/.github/workflows/update-license-file.yml b/.github/workflows/update-license-file.yml new file mode 100644 index 000000000..2ccfe6636 --- /dev/null +++ b/.github/workflows/update-license-file.yml | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | name: Update LICENSE file | ||
| 2 | |||
| 3 | on: | ||
| 4 | push: | ||
| 5 | branches: | ||
| 6 | - master | ||
| 7 | - walnascar | ||
| 8 | - styhead | ||
| 9 | - scarthgap | ||
| 10 | - nanbield | ||
| 11 | - mickledore | ||
| 12 | - kirkstone | ||
| 13 | - honister | ||
| 14 | - hardknott | ||
| 15 | - gatesgarth | ||
| 16 | - dunfell | ||
| 17 | paths: | ||
| 18 | - "**/*.bb" | ||
| 19 | - "**/*.inc" | ||
| 20 | schedule: | ||
| 21 | - cron: "0 0 * * *" # Runs daily at midnight | ||
| 22 | workflow_dispatch: # Allows manual run | ||
| 23 | |||
| 24 | jobs: | ||
| 25 | update-license: | ||
| 26 | runs-on: ubuntu-latest | ||
| 27 | |||
| 28 | steps: | ||
| 29 | - name: Checkout repository | ||
| 30 | uses: actions/checkout@v3 | ||
| 31 | |||
| 32 | - name: Run license generation script | ||
| 33 | run: | | ||
| 34 | ./scripts/generate-license-file | ||
| 35 | |||
| 36 | - name: Commit and push LICENSE file | ||
| 37 | run: | | ||
| 38 | git config --local user.name "github-actions[bot]" | ||
| 39 | git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
| 40 | git add LICENSE | ||
| 41 | if ! git diff-index --quiet HEAD; then | ||
| 42 | git commit -m "Auto-update LICENSE file with current recipe licenses" | ||
| 43 | git push | ||
| 44 | fi | ||
| 45 | |||
| 46 | env: | ||
| 47 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
diff --git a/scripts/generate-license-file b/scripts/generate-license-file new file mode 100755 index 000000000..b6d43cd9f --- /dev/null +++ b/scripts/generate-license-file | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | # Create or clear the LICENSE file | ||
| 4 | echo "# License Information" > LICENSE | ||
| 5 | echo "" >> LICENSE | ||
| 6 | echo "This file lists all licenses used by recipes in the meta-freescale-3rdparty layer." >> LICENSE | ||
| 7 | echo "" >> LICENSE | ||
| 8 | |||
| 9 | # Find all .bb and .inc files and extract license information | ||
| 10 | find . -type f \( -name "*.bb" -o -name "*.inc" \) | while read -r file; do | ||
| 11 | # Extract the license line from each recipe file, if it exists | ||
| 12 | license_line=$(grep -i "^LICENSE" "$file") | ||
| 13 | if [ -n "$license_line" ]; then | ||
| 14 | echo "$file: $license_line" >> LICENSE | ||
| 15 | fi | ||
| 16 | done | ||
| 17 | |||
| 18 | echo "LICENSE file has been generated and updated with current recipe licenses." | ||
