Skip to content

new aggregation IP Range (#1100) #101

new aggregation IP Range (#1100)

new aggregation IP Range (#1100) #101

name: Generate NOTICE.MD
on:
push:
branches:
- main
paths:
- 'quesma/go.mod'
- 'quesma/go.sum'
workflow_dispatch:
jobs:
generate-notice-file:
strategy:
matrix:
module: [ "quesma" ]
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
repository-projects: write
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
cache-dependency-path: ${{ matrix.module }}/go.sum
go-version: '1.23'
- name: Install go-licence-detector
working-directory: ${{ matrix.module }}
run: go get go.elastic.co/go-licence-detector && go install go.elastic.co/go-licence-detector
- name: Generate NOTICE.MD
working-directory: ${{ matrix.module }}
run: |
go mod tidy
go mod download all
go list -m -json all | jq 'select(.Path != "quesma_v2")' | go-licence-detector -includeIndirect -noticeTemplate=../.github/go-licence-detector/templates/NOTICE.MD.tmpl -noticeOut=../NOTICE.MD -depsTemplate=../.github/go-licence-detector/templates/dependencies.asciidoc.tmpl -depsOut=dependencies.asciidoc -overrides=../.github/go-licence-detector/overrides.ndjson
rm dependencies.asciidoc
- name: Print NOTICE.MD
run: cat NOTICE.MD
- name: Check if NOTICE.MD changed
id: notice-file-changed
run: |
git fetch origin
if git ls-tree --name-only origin/main | grep -q '^NOTICE.MD$'; then
if git diff --exit-code origin/main -- NOTICE.MD; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Close existing PRs
if: steps.notice-file-changed.outputs.changed == 'true'
run: |
open_prs=$(gh pr list --label notice.md --state open --json number --jq '.[].number')
for pr in $open_prs; do
gh pr close $pr
done
env:
GH_TOKEN: ${{ github.token }}
- name: Issue a Pull Request
if: steps.notice-file-changed.outputs.changed == 'true'
run: |
BRANCH_NAME="notice/$(date +%Y%m%d%H%M%S)"
git checkout -b "$BRANCH_NAME"
git config --local user.email "[email protected]"
git config --local user.name "Quesma[bot]"
git add NOTICE.MD
git commit -m "Update NOTICE.MD"
git push origin HEAD
gh pr create -l notice.md -l automation --title "Update NOTICE.MD" --body "There's been a change in Quesma dependencies" --base main --head "$BRANCH_NAME"
env:
GH_TOKEN: ${{ secrets.NOTICE_MD_UPDATER_GH_TOKEN }}