Skip to content

Commit

Permalink
ci: include workflow to commit SPDX updates as bot (#835)
Browse files Browse the repository at this point in the history
* ci: configure bot to update SPDX License

* ci: docs

* ci: description

* added env

* code review changes (@wolfenrain)

* ci: updated workflow
  • Loading branch information
alestiago committed Oct 4, 2023
1 parent 3125746 commit 9143523
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/spdx_license_bot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: spdx_license_bot

on:
# This should ideally trigger whenever there is a commit to the [SPDX License repository](https://github.com/spdx/license-list-data).
# However, this is not yet possible see: https://github.com/orgs/community/discussions/26323
schedule:
# At 08:04 on every day-of-week from Monday through Friday.
- cron: "4 8 * * 1-5"
workflow_dispatch:

jobs:
build:
defaults:
run:
working-directory: tool/spdx_license

runs-on: ubuntu-latest

steps:
- name: 馃摎 Git Checkout
uses: actions/checkout@v4

- name: 馃幆 Setup Dart
uses: dart-lang/setup-dart@v1

- name: 馃摝 Install Dependencies
run: dart pub get

- name: 馃捇 Install Mason
run: |
dart pub global activate mason_cli
mason get
- name: 馃П Mason Make
id: make
run: if [[ $(mason make spdx_license -q --licenses "[]" -o test --on-conflict overwrite --set-exit-if-changed) =~ "0 files changed" ]]; then echo "did_change=false"; else echo "did_change=true"; fi >> $GITHUB_ENV

- name: 馃攽 Config Git User
if: ${{ env.did_change == 'true' }}
run: |
git config user.name VGV Bot
git config user.email vgvbot@users.noreply.github.com
- name: 馃摑 Create Pull Request
if: ${{ env.did_change == 'true' }}
uses: peter-evans/create-pull-request@v5.0.2
with:
base: main
branch: chore/update-spdx-license
commit-message: "chore: update SPDX licenses"
title: "chore: update SPDX licenses"
body: Please squash and merge me!
labels: bot
author: VGV Bot <vgvbot@users.noreply.github.com>
assignees: vgvbot
committer: VGV Bot <vgvbot@users.noreply.github.com>

0 comments on commit 9143523

Please sign in to comment.