From 24b98b96172181353d6514615eba554fc0440d09 Mon Sep 17 00:00:00 2001 From: balqaasem Date: Mon, 3 Aug 2026 02:48:12 +0800 Subject: [PATCH 1/7] fix: align workflows with changelogger canonical pattern, use --dir prdoc for CHANGELOG.md generation --- .github/workflows/cd.yml | 128 +++++++++++++++------------- .github/workflows/command-prdoc.yml | 114 ------------------------- .github/workflows/prdoc.yml | 57 +++---------- .github/workflows/release.yml | 90 ++++++++----------- changelogger.toml | 1 - prdoc/.template.prdoc | 13 --- 6 files changed, 116 insertions(+), 287 deletions(-) delete mode 100644 .github/workflows/command-prdoc.yml delete mode 100644 prdoc/.template.prdoc diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 3d031a7..7590b92 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -3,37 +3,6 @@ # # Copyright (C) 2026-Present Afsall Inc. # SPDX-License-Identifier: Apache-2.0 OR MIT -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Alternatively, this file is available under the MIT License: -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. name: CD on: @@ -65,46 +34,87 @@ jobs: echo "changed=true" >> "$GITHUB_OUTPUT" fi - publish: + changelog: needs: detect if: needs.detect.outputs.changed == 'true' runs-on: ubuntu-latest permissions: contents: write - packages: write steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Install Rust uses: dtolnay/rust-toolchain@v1 with: toolchain: stable - - name: Publish forehead-core - run: | - VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') - if ! curl -s "https://crates.io/api/v1/crates/forehead-core" | grep -q "\"version\":\"$VERSION\""; then - cargo publish -p forehead-core - else - echo "forehead-core v$VERSION already exists, skipping" - fi - env: - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - - name: Publish forehead-cli - run: | - VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') - if ! curl -s "https://crates.io/api/v1/crates/forehead-cli" | grep -q "\"version\":\"$VERSION\""; then - cargo publish -p forehead-cli - else - echo "forehead-cli v$VERSION already exists, skipping" - fi - env: - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + - uses: Swatinem/rust-cache@v2 - name: Install changelogger run: cargo install changelogger-cli --version 0.2.1 - - - name: Generate and update CHANGELOG.md + - name: Generate CHANGELOG + run: changelogger changelog generate --dir prdoc --output CHANGELOG.md + - name: Commit and tag run: | - VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') - changelogger changelog generate --from "v${VERSION}" --output CHANGELOG.md - changelogger changelog bump --current "$VERSION" --from "v${VERSION}" + VERSION=${{ needs.detect.outputs.version }} + git config user.name "changelogger-bot" + git config user.email "bot@github.com" git add CHANGELOG.md - git commit -m "chore: update CHANGELOG.md for v${VERSION}" || true \ No newline at end of file + git commit -m "changelog: auto-generate for v${VERSION}" || true + git tag "v${VERSION}" + git push origin "v${VERSION}" + + crates-io: + needs: detect + if: needs.detect.outputs.changed == 'true' + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - name: Install Rust + uses: dtolnay/rust-toolchain@v1 + with: + toolchain: stable + - uses: Swatinem/rust-cache@v2 + - name: Install changelogger + run: cargo install changelogger-cli --version 0.2.1 + - name: Publish to crates.io + run: changelogger publish + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + + container: + needs: detect + if: needs.detect.outputs.changed == 'true' + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}},value=v${{ needs.detect.outputs.version }} + type=semver,pattern={{major}}.{{minor}},value=v${{ needs.detect.outputs.version }} + type=raw,value=latest + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file diff --git a/.github/workflows/command-prdoc.yml b/.github/workflows/command-prdoc.yml deleted file mode 100644 index d020ddb..0000000 --- a/.github/workflows/command-prdoc.yml +++ /dev/null @@ -1,114 +0,0 @@ -# بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم -# This file is part of forehead. -# -# Copyright (C) 2026-Present Afsall Inc. -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Alternatively, this file is available under the MIT License: -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -name: Command PRDoc -on: - workflow_dispatch: - inputs: - pr: - type: number - description: Number of the Pull Request - required: true - bump: - type: choice - description: Default bump level for all crates - default: "patch" - required: true - options: - - "patch" - - "minor" - - "major" - - "none" - audience: - type: choice - description: Audience of the PRDoc - default: "developer" - required: true - options: - - "developer" - - "user" - - "operator" - overwrite: - type: boolean - description: Overwrite existing PRDoc - default: false - required: true - -permissions: - contents: write - pull-requests: write - -jobs: - cmd-prdoc: - runs-on: ubuntu-latest - timeout-minutes: 20 - steps: - - name: Get PR branch - id: pr - env: - GH_TOKEN: ${{ github.token }} - run: | - BRANCH=$(gh pr view "${{ inputs.pr }}" --json headRefName -q '.headRefName') - echo "branch=$BRANCH" >> "$GITHUB_OUTPUT" - - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ steps.pr.outputs.branch }} - - - name: Install changelogger - run: cargo install changelogger-cli --version 0.2.1 - - - name: Generate PRDoc - env: - GH_TOKEN: ${{ github.token }} - run: | - FLAGS="" - if [ "${{ inputs.overwrite }}" = "true" ]; then - FLAGS="--force" - fi - changelogger prdoc generate \ - --pr "${{ inputs.pr }}" \ - --bump "${{ inputs.bump }}" \ - --audience "${{ inputs.audience }}" \ - $FLAGS - - - name: Commit PRDoc - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_message: "Add prdoc for PR #${{ inputs.pr }} (auto-generated)" - file_pattern: "prdoc/*.prdoc" \ No newline at end of file diff --git a/.github/workflows/prdoc.yml b/.github/workflows/prdoc.yml index 910269e..b3f75db 100644 --- a/.github/workflows/prdoc.yml +++ b/.github/workflows/prdoc.yml @@ -3,37 +3,6 @@ # # Copyright (C) 2026-Present Afsall Inc. # SPDX-License-Identifier: Apache-2.0 OR MIT -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Alternatively, this file is available under the MIT License: -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. name: PRDoc on: @@ -52,10 +21,13 @@ jobs: with: fetch-depth: 0 ref: ${{ github.head_ref }} - + - name: Install Rust + uses: dtolnay/rust-toolchain@v1 + with: + toolchain: stable + - uses: Swatinem/rust-cache@v2 - name: Install changelogger run: cargo install changelogger-cli --version 0.2.1 - - name: Generate PRDoc id: generate env: @@ -64,28 +36,23 @@ jobs: PR_NUM=${{ github.event.pull_request.number }} PRDOC="prdoc/pr_${PR_NUM}.prdoc" if [ -f "$PRDOC" ]; then - echo "PRDoc already exists at $PRDOC — validating only" + echo "PRDoc already exists — validating only" echo "generated=false" >> "$GITHUB_OUTPUT" else - changelogger prdoc generate --pr "$PR_NUM" --force --bump patch + changelogger prdoc generate --pr "$PR_NUM" --force echo "generated=true" >> "$GITHUB_OUTPUT" fi - python3 -c " -import re -with open('$PRDOC') as f: - c = f.read() -c = c.replace('crates: [ ]', 'crates:\n - name: forehead-core\n bump: patch\n - name: forehead-cli\n bump: patch') -with open('$PRDOC', 'w') as f: - f.write(c) -" - - name: Validate PRDoc env: CI: "true" run: | PRDOC="prdoc/pr_${{ github.event.pull_request.number }}.prdoc" changelogger prdoc validate "$PRDOC" - + - name: Validate Backport Rules + if: startsWith(github.base_ref, 'stable') || startsWith(github.base_ref, 'release') + run: | + PRDOC="prdoc/pr_${{ github.event.pull_request.number }}.prdoc" + changelogger prdoc validate --branch "${{ github.base_ref }}" "$PRDOC" - name: Commit PRDoc if: steps.generate.outputs.generated == 'true' uses: stefanzweifel/git-auto-commit-action@v5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c2d8dec..d888423 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,37 +3,6 @@ # # Copyright (C) 2026-Present Afsall Inc. # SPDX-License-Identifier: Apache-2.0 OR MIT -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Alternatively, this file is available under the MIT License: -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. name: Release on: @@ -56,31 +25,44 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@v1 with: - toolchain: nightly-2026-02-18 + toolchain: stable - uses: Swatinem/rust-cache@v2 - - name: Extract version from Cargo.toml - id: version - run: | - VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') - echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT" - name: Build run: cargo build --release --workspace - - - name: Install changelogger - run: cargo install changelogger-cli --version 0.2.1 - - - name: Generate changelog - run: | - changelogger changelog generate --from "${{ github.ref_name }}" --output CHANGELOG.md - changelogger changelog bump --current "${{ steps.version.outputs.VERSION }}" - - name: Create GitHub Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh release create "${{ github.ref_name }}" \ - --title "forehead v${{ steps.version.outputs.VERSION }}" \ - --generate-notes + TAG="${{ github.ref_name }}" + if gh release view "$TAG" &>/dev/null; then + echo "Release $TAG already exists — skipping" + else + NOTES="" + if [ -f CHANGELOG.md ]; then + NOTES="--notes-file CHANGELOG.md" + fi + gh release create "$TAG" \ + --title "forehead $TAG" \ + $NOTES + fi + + crates-io: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - name: Install Rust + uses: dtolnay/rust-toolchain@v1 + with: + toolchain: stable + - uses: Swatinem/rust-cache@v2 + - name: Install changelogger + run: cargo install changelogger-cli --version 0.2.1 + - name: Publish to crates.io + run: changelogger publish + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} container: runs-on: ubuntu-latest @@ -97,22 +79,20 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract version from Cargo.toml + - name: Extract version from tag id: version - run: | - VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') - echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT" + run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" - name: Build and push uses: docker/build-push-action@v6 with: context: . push: true tags: | - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${{ steps.version.outputs.VERSION }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest labels: | org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} - org.opencontainers.image.description=Create and maintain file headers for code license + org.opencontainers.image.description=A tool for creating and maintaining file headers for code license org.opencontainers.image.licenses=Apache-2.0 OR MIT cache-from: type=gha cache-to: type=gha,mode=max \ No newline at end of file diff --git a/changelogger.toml b/changelogger.toml index 36117eb..6b0980b 100644 --- a/changelogger.toml +++ b/changelogger.toml @@ -39,7 +39,6 @@ version = 1 schema = "prdoc/schema_user.json" output_dir = "prdoc" prdoc_folders = ["prdoc"] -template = "prdoc/.template.prdoc" [audiences] developer = "Developer" diff --git a/prdoc/.template.prdoc b/prdoc/.template.prdoc deleted file mode 100644 index 829cf50..0000000 --- a/prdoc/.template.prdoc +++ /dev/null @@ -1,13 +0,0 @@ -# PRDoc: Pull Request Documentation -# Fill in the ... placeholders with meaningful content. - ---- -title: ... - -doc: - - audience: Developer - description: | - ... - -crates: [ ] ---- \ No newline at end of file From 858955a8fa22a2e7b8003fb17f03aa6994c48c89 Mon Sep 17 00:00:00 2001 From: balqaasem Date: Mon, 3 Aug 2026 03:19:47 +0800 Subject: [PATCH 2/7] fix: use --release flag in CD workflow for versioned changelog sections --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 7590b92..c024694 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -52,7 +52,7 @@ jobs: - name: Install changelogger run: cargo install changelogger-cli --version 0.2.1 - name: Generate CHANGELOG - run: changelogger changelog generate --dir prdoc --output CHANGELOG.md + run: changelogger changelog generate --dir prdoc --output CHANGELOG.md --release "${{ needs.detect.outputs.version }}" - name: Commit and tag run: | VERSION=${{ needs.detect.outputs.version }} From 7f00eb0889ada5209c79a5a49244a8e31c851c13 Mon Sep 17 00:00:00 2001 From: balqaasem Date: Tue, 4 Aug 2026 02:54:39 +0800 Subject: [PATCH 3/7] chore: bump changelogger-cli to v0.2.2 in all workflows and mise.toml --- .github/workflows/cd.yml | 4 ++-- .github/workflows/prdoc.yml | 2 +- .github/workflows/release.yml | 2 +- mise.toml | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index c024694..e4cd9f3 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -50,7 +50,7 @@ jobs: toolchain: stable - uses: Swatinem/rust-cache@v2 - name: Install changelogger - run: cargo install changelogger-cli --version 0.2.1 + run: cargo install changelogger-cli --version 0.2.2 - name: Generate CHANGELOG run: changelogger changelog generate --dir prdoc --output CHANGELOG.md --release "${{ needs.detect.outputs.version }}" - name: Commit and tag @@ -77,7 +77,7 @@ jobs: toolchain: stable - uses: Swatinem/rust-cache@v2 - name: Install changelogger - run: cargo install changelogger-cli --version 0.2.1 + run: cargo install changelogger-cli --version 0.2.2 - name: Publish to crates.io run: changelogger publish env: diff --git a/.github/workflows/prdoc.yml b/.github/workflows/prdoc.yml index b3f75db..c98d876 100644 --- a/.github/workflows/prdoc.yml +++ b/.github/workflows/prdoc.yml @@ -27,7 +27,7 @@ jobs: toolchain: stable - uses: Swatinem/rust-cache@v2 - name: Install changelogger - run: cargo install changelogger-cli --version 0.2.1 + run: cargo install changelogger-cli --version 0.2.2 - name: Generate PRDoc id: generate env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d888423..5db2353 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,7 +58,7 @@ jobs: toolchain: stable - uses: Swatinem/rust-cache@v2 - name: Install changelogger - run: cargo install changelogger-cli --version 0.2.1 + run: cargo install changelogger-cli --version 0.2.2 - name: Publish to crates.io run: changelogger publish env: diff --git a/mise.toml b/mise.toml index caf5ec2..a563c08 100644 --- a/mise.toml +++ b/mise.toml @@ -56,5 +56,5 @@ description = "Run all CI checks" depends = ["fmt", "headers", "clippy", "test", "build"] [tasks.changelogger] -description = "Install changelogger-cli v0.2.1" -run = "cargo install changelogger-cli --version 0.2.1" \ No newline at end of file +description = "Install changelogger-cli v0.2.2" +run = "cargo install changelogger-cli --version 0.2.2" \ No newline at end of file From ae342a03b6bd04cf402eac8515ab1f6b4629fd13 Mon Sep 17 00:00:00 2001 From: balqaasem Date: Tue, 4 Aug 2026 03:31:26 +0800 Subject: [PATCH 4/7] fix: apply license headers to new workflow files --- .github/workflows/cd.yml | 31 +++++++++++++++++++++++++++++++ .github/workflows/prdoc.yml | 31 +++++++++++++++++++++++++++++++ .github/workflows/release.yml | 31 +++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e4cd9f3..fbac3bf 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -3,6 +3,37 @@ # # Copyright (C) 2026-Present Afsall Inc. # SPDX-License-Identifier: Apache-2.0 OR MIT +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Alternatively, this file is available under the MIT License: +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. name: CD on: diff --git a/.github/workflows/prdoc.yml b/.github/workflows/prdoc.yml index c98d876..c120543 100644 --- a/.github/workflows/prdoc.yml +++ b/.github/workflows/prdoc.yml @@ -3,6 +3,37 @@ # # Copyright (C) 2026-Present Afsall Inc. # SPDX-License-Identifier: Apache-2.0 OR MIT +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Alternatively, this file is available under the MIT License: +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. name: PRDoc on: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5db2353..52f3c41 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,6 +3,37 @@ # # Copyright (C) 2026-Present Afsall Inc. # SPDX-License-Identifier: Apache-2.0 OR MIT +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Alternatively, this file is available under the MIT License: +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. name: Release on: From b943cd4130a55e7e7c37d3d3a119c0ac733d14a1 Mon Sep 17 00:00:00 2001 From: balqaasem Date: Tue, 4 Aug 2026 03:36:01 +0800 Subject: [PATCH 5/7] fix: skip .github/ directory in forehead header checks --- .github/workflows/cd.yml | 37 ------------------------------- .github/workflows/prdoc.yml | 37 ------------------------------- .github/workflows/release.yml | 37 ------------------------------- packages/forehead-core/src/lib.rs | 2 +- 4 files changed, 1 insertion(+), 112 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index fbac3bf..b09156a 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,40 +1,3 @@ -# بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم -# This file is part of forehead. -# -# Copyright (C) 2026-Present Afsall Inc. -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Alternatively, this file is available under the MIT License: -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - name: CD on: push: diff --git a/.github/workflows/prdoc.yml b/.github/workflows/prdoc.yml index c120543..0bdfe13 100644 --- a/.github/workflows/prdoc.yml +++ b/.github/workflows/prdoc.yml @@ -1,40 +1,3 @@ -# بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم -# This file is part of forehead. -# -# Copyright (C) 2026-Present Afsall Inc. -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Alternatively, this file is available under the MIT License: -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - name: PRDoc on: pull_request: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 52f3c41..350ee65 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,40 +1,3 @@ -# بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم -# This file is part of forehead. -# -# Copyright (C) 2026-Present Afsall Inc. -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Alternatively, this file is available under the MIT License: -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - name: Release on: push: diff --git a/packages/forehead-core/src/lib.rs b/packages/forehead-core/src/lib.rs index 3870788..938cf04 100644 --- a/packages/forehead-core/src/lib.rs +++ b/packages/forehead-core/src/lib.rs @@ -52,7 +52,7 @@ pub mod error; pub mod header; pub mod template; -const SKIP_DIRS: &[&str] = &[".git", "target", "node_modules"]; +const SKIP_DIRS: &[&str] = &[".git", "target", "node_modules", ".github"]; const SKIP_FILES: &[&str] = &["Cargo.lock", "forehead.toml"]; pub struct Forehead { From 8a49897f99221495a701f8731fd2855ed5000f82 Mon Sep 17 00:00:00 2001 From: balqaasem Date: Tue, 4 Aug 2026 03:40:24 +0800 Subject: [PATCH 6/7] release: bump to v0.2.1 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- packages/forehead-cli/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d23b0d..bc1cffd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -152,7 +152,7 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "forehead-cli" -version = "0.1.4" +version = "0.2.1" dependencies = [ "anyhow", "clap", @@ -165,7 +165,7 @@ dependencies = [ [[package]] name = "forehead-core" -version = "0.1.4" +version = "0.2.1" dependencies = [ "regex", "serde", diff --git a/Cargo.toml b/Cargo.toml index 8f3cb3f..ddf6d76 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ members = [ ] [workspace.package] -version = "0.1.4" +version = "0.2.1" edition = "2021" license = "Apache-2.0 OR MIT" authors = ["Afsall Inc"] diff --git a/packages/forehead-cli/Cargo.toml b/packages/forehead-cli/Cargo.toml index 38add31..36e2a29 100644 --- a/packages/forehead-cli/Cargo.toml +++ b/packages/forehead-cli/Cargo.toml @@ -9,7 +9,7 @@ description.workspace = true readme = "README.md" [dependencies] -forehead-core = { path = "../forehead-core", version = "0.1.4" } +forehead-core = { path = "../forehead-core", version = "0.2.1" } clap.workspace = true anyhow.workspace = true serde.workspace = true From cfef8bfdcca4dde80d308d9e9d6283e8fb7a84fd Mon Sep 17 00:00:00 2001 From: balqaasem <15086345+balqaasem@users.noreply.github.com> Date: Mon, 3 Aug 2026 23:13:06 +0000 Subject: [PATCH 7/7] Add prdoc for PR #17 (auto-generated) --- prdoc/pr_17.prdoc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 prdoc/pr_17.prdoc diff --git a/prdoc/pr_17.prdoc b/prdoc/pr_17.prdoc new file mode 100644 index 0000000..e736e9d --- /dev/null +++ b/prdoc/pr_17.prdoc @@ -0,0 +1,16 @@ +--- +title: Changelogger upgrade +author: balqaasem +pr: 17 + +doc: + - audience: Developer + description: | + Changes for PR #17 + +crates: + - name: forehead-cli + bump: minor + - name: forehead-core + bump: minor +---