From 36c616d665a156dd5a22a1d9d062396666734f08 Mon Sep 17 00:00:00 2001 From: Florian Weber Date: Fri, 27 Jun 2025 14:14:31 +0200 Subject: [PATCH] Add license check and issue creation for Homebrewery license changes --- .gitea/ISSUE_LICENSE_CHANGED.md | 9 +++++++++ .gitea/workflows/update.yaml | 28 +++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 .gitea/ISSUE_LICENSE_CHANGED.md diff --git a/.gitea/ISSUE_LICENSE_CHANGED.md b/.gitea/ISSUE_LICENSE_CHANGED.md new file mode 100644 index 0000000..c5ce39c --- /dev/null +++ b/.gitea/ISSUE_LICENSE_CHANGED.md @@ -0,0 +1,9 @@ +--- +title: License of upstream Homebrewery has changed +assignees: f.weber +labels: bug +--- + +It seems that [naturalcrit/homebrewery](https://github.com/naturalcrit/homebrewery) is not using the MIT license anymore. + +We have to check that and if we are still allowed to use their project. diff --git a/.gitea/workflows/update.yaml b/.gitea/workflows/update.yaml index 0fea7bb..dde0c4c 100644 --- a/.gitea/workflows/update.yaml +++ b/.gitea/workflows/update.yaml @@ -17,7 +17,19 @@ jobs: update: runs-on: ubuntu-24.04 steps: + - name: Check current license + run: | + resp=$(curl -sSf \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${{ secrets.GH_TOKEN }}" \ + https://api.github.com/repos/naturalcrit/homebrewery) + + license=$(echo "$resp" | jq -r .license.spdx_id) + + echo "LICENSE=$license" >>"$GITHUB_ENV" + - name: Get latest Homebrewery release via GitHub API + if: ${{ env.license == 'MIT' }} run: | resp=$(curl -sSf \ -H "Accept: application/vnd.github.v3+json" \ @@ -27,7 +39,7 @@ jobs: id=$( echo "$resp" | jq -r .id) tag_name=$( echo "$resp" | jq -r .tag_name) name=$( echo "$resp" | jq -r .name) - url=$( echo "$resp" | jq -r .url) + url=$( echo "$resp" | jq -r .html_url) draft=$( echo "$resp" | jq -r .draft) prerelease=$( echo "$resp" | jq -r .prerelease) body_text=$( echo "$resp" | jq -r .body) @@ -47,11 +59,12 @@ jobs: printf '\n' printf '%s\n' "$body_text" printf '\n' - printf '%s\n' "See original Changelog from [$name]($html_url)" + printf '%s\n' "See original Changelog from [$name]($url)" echo "EOF" } >>"$GITHUB_ENV" - name: Debug step + if: ${{ env.license == 'MIT' }} run: | echo "id: $ID" echo "draft: $DRAFT" @@ -62,10 +75,19 @@ jobs: - name: Create Docker Release uses: softprops/action-gh-release@v2 - if: ${{ env.ID > 0 && env.DRAFT != 'true' }} + if: ${{ env.license == 'MIT' && env.ID > 0 && env.DRAFT != 'true' }} with: token: ${{ secrets.GT_UPDATE_TOKEN }} prerelease: ${{ env.PRERELEASE }} name: ${{ env.NAME }} tag_name: ${{ env.TAG_NAME }} body: ${{ env.RELEASE_BODY }} + + - name: Create License changed issue + uses: JasonEtco/create-an-issue@v2 + env: + GITHUB_TOKEN: ${{ secrets.GT_UPDATE_TOKEN }} + with: + update_existing: true + search_existing: open + filename: .gitea/ISSUE_LICENSE_CHANGED.md