From 6792a340dd0c1e3e7ffef63aba6466a95fecb39f Mon Sep 17 00:00:00 2001 From: Oakchris1955 <80592203+Oakchris1955@users.noreply.github.com> Date: Sat, 20 Jul 2024 11:05:03 +0300 Subject: [PATCH 1/6] chore(changelog): create gen-changelog.yml --- .github/workflows/gen-changelog.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/gen-changelog.yml diff --git a/.github/workflows/gen-changelog.yml b/.github/workflows/gen-changelog.yml new file mode 100644 index 0000000..df4aeaa --- /dev/null +++ b/.github/workflows/gen-changelog.yml @@ -0,0 +1,23 @@ +on: [ push ] + +jobs: + changelog: + name: Generate changelog + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Generate a changelog + uses: orhun/git-cliff-action@v3 + id: git-cliff + with: + config: cliff.toml + args: --verbose + env: + OUTPUT: CHANGELOG.md + + - name: Print the changelog + run: cat "${{ steps.git-cliff.outputs.changelog }}" From e24ef363ca715d32ec338dcb397fd1bb3ae7ba56 Mon Sep 17 00:00:00 2001 From: Oakchris1955 <80592203+Oakchris1955@users.noreply.github.com> Date: Sat, 20 Jul 2024 11:11:05 +0300 Subject: [PATCH 2/6] chore(config): ignore chore commits from the CHANGELOG --- cliff.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/cliff.toml b/cliff.toml index 29d6099..d57cece 100644 --- a/cliff.toml +++ b/cliff.toml @@ -55,6 +55,7 @@ filter_unconventional = true split_commits = false # regex for parsing and grouping commits commit_parsers = [ + { message = "^chore", skip = true }, { message = "^.*: add", group = "Added" }, { message = "^.*: create", group = "Added" }, { message = "^.*: support", group = "Added" }, From 2ea4a383a8aa1080eda1d4c7b7689adc911d32a5 Mon Sep 17 00:00:00 2001 From: Oakchris1955 <80592203+Oakchris1955@users.noreply.github.com> Date: Sat, 20 Jul 2024 11:18:19 +0300 Subject: [PATCH 3/6] chore(git): ignore ci commits from the CHANGELOG --- cliff.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/cliff.toml b/cliff.toml index d57cece..1675332 100644 --- a/cliff.toml +++ b/cliff.toml @@ -56,6 +56,7 @@ split_commits = false # regex for parsing and grouping commits commit_parsers = [ { message = "^chore", skip = true }, + { message = "^ci", skip = true }, { message = "^.*: add", group = "Added" }, { message = "^.*: create", group = "Added" }, { message = "^.*: support", group = "Added" }, From ba684ae1d44e1b525371c4f1e7f67ffeded28659 Mon Sep 17 00:00:00 2001 From: Oakchris1955 <80592203+Oakchris1955@users.noreply.github.com> Date: Sat, 20 Jul 2024 11:20:05 +0300 Subject: [PATCH 4/6] chore(changelog): update gen-changelog.yml The CI script should now create commits to automatically update the CHANGELOG once per week --- .github/workflows/gen-changelog.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gen-changelog.yml b/.github/workflows/gen-changelog.yml index df4aeaa..5ac85d7 100644 --- a/.github/workflows/gen-changelog.yml +++ b/.github/workflows/gen-changelog.yml @@ -1,4 +1,7 @@ -on: [ push ] +name: Update CHANGELOG.md weekly +on: + schedule: + - cron: "0 0 * * 0" jobs: changelog: @@ -12,12 +15,24 @@ jobs: - name: Generate a changelog uses: orhun/git-cliff-action@v3 - id: git-cliff with: config: cliff.toml args: --verbose env: OUTPUT: CHANGELOG.md + GITHUB_REPO: ${{ github.repository }} + GITHUB_BRANCH: ${{ github.ref_name }} - - name: Print the changelog - run: cat "${{ steps.git-cliff.outputs.changelog }}" + - name: Prepare commit + run: | + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + set +e + git add CHANGELOG.md + git commit -m "ci(changelog): Update changelog" + + - name: Push commit + # if there is nothing to commit, `git commit` returns 1 + if: success() + run: | + git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git ${GITHUB_BRANCH} From 07d75c130bc29d48c2865f2b00de45ec81946985 Mon Sep 17 00:00:00 2001 From: Oakchris1955 <80592203+Oakchris1955@users.noreply.github.com> Date: Sat, 20 Jul 2024 13:43:04 +0300 Subject: [PATCH 5/6] chore(config): Exclude changes to testing files from CHANGELOG --- cliff.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/cliff.toml b/cliff.toml index 1675332..81fe203 100644 --- a/cliff.toml +++ b/cliff.toml @@ -57,6 +57,7 @@ split_commits = false commit_parsers = [ { message = "^chore", skip = true }, { message = "^ci", skip = true }, + { message = "^test", skip = true }, { message = "^.*: add", group = "Added" }, { message = "^.*: create", group = "Added" }, { message = "^.*: support", group = "Added" }, From 953095fa7d7c2bd7bf567a0dcdce809695d93a39 Mon Sep 17 00:00:00 2001 From: Oakchris1955 <80592203+Oakchris1955@users.noreply.github.com> Date: Mon, 22 Jul 2024 13:16:54 +0300 Subject: [PATCH 6/6] chore(ci): allow manual dispatch of gen-changelog workflow --- .github/workflows/gen-changelog.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/gen-changelog.yml b/.github/workflows/gen-changelog.yml index 5ac85d7..a30e01c 100644 --- a/.github/workflows/gen-changelog.yml +++ b/.github/workflows/gen-changelog.yml @@ -1,5 +1,6 @@ name: Update CHANGELOG.md weekly on: + workflow_dispatch: schedule: - cron: "0 0 * * 0"