-
Notifications
You must be signed in to change notification settings - Fork 2
Automate docs and license generation #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
aee86e8
feat (docs): Add auto generation of license and docs
OliverTrautvetter 4b0ba30
fix: prevent new workflow from doing loops and ignoring merges
OliverTrautvetter f026b7e
auto(docs): update docs and licenses
OliverTrautvetter 3b694fc
fix: amend last commit with auto-generated changes instead of using s…
OliverTrautvetter 630bfdf
fix: amend last commit with auto-generated changes instead of using s…
OliverTrautvetter 6434e76
fix: add signoff to auto-amend commit in update-docs-and-licenses wor…
OliverTrautvetter f7b9fe7
docs: Describe service root command, update README (#32)
NautiluX d5c2d20
feat (docs): Add auto generation of license and docs
OliverTrautvetter 86e49c2
fix: prevent new workflow from doing loops and ignoring merges
OliverTrautvetter c09a065
auto(docs): update docs and licenses
OliverTrautvetter 4a17380
fix: amend last commit with auto-generated changes instead of using s…
OliverTrautvetter ba8c5c1
fix: add signoff to auto-amend commit in update-docs-and-licenses wor…
OliverTrautvetter 2dec140
Merge branch 'automate_docs_and_license_generation' of https://github…
OliverTrautvetter 5ee6bf2
fix: amend last commit with auto-generated changes instead of using s…
OliverTrautvetter b3f17bd
Merge branch 'automate_docs_and_license_generation' of https://github…
OliverTrautvetter df61193
Merge branch 'automate_docs_and_license_generation' of https://github…
OliverTrautvetter d20d4b3
Merge branch 'automate_docs_and_license_generation' of https://github…
OliverTrautvetter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| # Copyright (c) Codesphere Inc. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| name: golangci-lint | ||
| on: | ||
| push: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| # Copyright (c) Codesphere Inc. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| name: Tag | ||
|
|
||
| on: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Copyright (c) Codesphere Inc. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| name: 'Auto-Update Docs & Licenses' | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize] | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| update-files: | ||
| # skip runs triggered by the bot's own commit to avoid loops | ||
| if: github.actor != 'github-actions[bot]' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| # on push to main, use main; on PR, check out the PR head | ||
| ref: ${{ github.event.pull_request.head.ref || github.ref }} | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Update docs & licenses | ||
| run: | | ||
| ./hack/update-docs-and-licenses.sh | ||
|
|
||
| - name: Commit and push changes | ||
| uses: EndBug/add-and-commit@v9 | ||
| with: | ||
| message: "auto(docs): update docs and licenses" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| #!/usr/bin/env bash | ||
| # Copyright (c) Codesphere Inc. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -euo pipefail | ||
| IFS=$'\n\t' | ||
|
|
||
| here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
| root=$(cd "$here/.." && pwd) | ||
|
|
||
| echo "Working directory: $root" | ||
|
|
||
| cd "$root" | ||
|
|
||
| echo "1/2: Generating docs" | ||
|
|
||
| if command -v go >/dev/null 2>&1; then | ||
| go run ./hack/gendocs/main.go | ||
| echo "Docs generated into: $root/docs" | ||
| else | ||
| echo "ERROR: 'go' binary not found in PATH. Install Go and retry." >&2 | ||
| exit 2 | ||
| fi | ||
|
|
||
| echo "2/2: Updating licenses" | ||
|
|
||
| echo "Checking license tooling: go-licenses + addlicense" | ||
|
|
||
| export GOBIN="$(go env GOBIN 2>/dev/null || echo "$HOME/go/bin")" | ||
| export PATH="$GOBIN:$PATH" | ||
|
|
||
| need_install=() | ||
| if ! command -v go-licenses >/dev/null 2>&1; then | ||
| need_install+=("github.com/google/go-licenses@latest") | ||
| fi | ||
| if ! command -v addlicense >/dev/null 2>&1; then | ||
| need_install+=("github.com/google/addlicense@latest") | ||
| fi | ||
|
|
||
| if [ ${#need_install[@]} -ne 0 ]; then | ||
| echo "Installing missing tools: ${need_install[*]}" | ||
| for pkg in "${need_install[@]}"; do | ||
| if command -v go >/dev/null 2>&1; then | ||
| go install "$pkg" | ||
| else | ||
| echo "ERROR: 'go' binary not found; cannot install $pkg" >&2 | ||
| exit 2 | ||
| fi | ||
| done | ||
| fi | ||
|
|
||
| echo "Generating NOTICE via go-licenses" | ||
| if command -v go-licenses >/dev/null 2>&1; then | ||
|
|
||
| if ! go-licenses report --template .NOTICE.template ./... > NOTICE 2> >(grep -v "module .* has empty version, defaults to HEAD" >&2); then | ||
| echo "go-licenses report failed" >&2 | ||
| fi | ||
| echo "NOTICE generated/updated" | ||
| else | ||
| echo "go-licenses not available; skipping NOTICE generation" >&2 | ||
| fi | ||
|
|
||
| echo "Done." | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| // Copyright (c) Codesphere Inc. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package portal | ||
|
|
||
| import "time" | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| // Copyright (c) Codesphere Inc. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package util | ||
|
|
||
| import ( | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.