From e0a376ab0377ec86eba6aa42e5f32efa44cac17b Mon Sep 17 00:00:00 2001 From: carsakiller Date: Thu, 23 May 2024 07:38:16 +0000 Subject: [PATCH 01/10] add: workflow to assert changelog updates --- .github/scripts/check-changelog.sh | 16 ++++++++++++++++ .github/workflows/changelog.yml | 24 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100755 .github/scripts/check-changelog.sh create mode 100644 .github/workflows/changelog.yml diff --git a/.github/scripts/check-changelog.sh b/.github/scripts/check-changelog.sh new file mode 100755 index 000000000..8484a3869 --- /dev/null +++ b/.github/scripts/check-changelog.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +CHANGELOG_FILE="changelog.md" + +git fetch + +# Check if the changelog file was modified in the PR +if git diff --name-only origin/$GITHUB_BASE_REF..$GITHUB_HEAD_REF | grep -q $CHANGELOG_FILE; then + echo "Thank you for updating the changelog!" + exit 0 +else + echo "Changelog has not been updated. Please update $CHANGELOG_FILE!" + exit 1 +fi diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 000000000..ccf936458 --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,24 @@ +name: changelog + +on: + pull_request: + types: [opened, synchronize] + branches: + - master + +jobs: + check-changelog: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Need entire git history + + - name: Set up environment + run: | + echo "GITHUB_HEAD_REF=${{ github.head_ref }}" >> $GITHUB_ENV + echo "GITHUB_BASE_REF=${{ github.base_ref }}" >> $GITHUB_ENV + + - name: Check if changelog is updated + run: .github/scripts/check-changelog.sh From fc3a8b2d2b3afb10b5d2f0badbe2301058e0b9d9 Mon Sep 17 00:00:00 2001 From: carsakiller Date: Thu, 23 May 2024 08:02:00 +0000 Subject: [PATCH 02/10] fix: fetch --- .github/scripts/check-changelog.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/check-changelog.sh b/.github/scripts/check-changelog.sh index 8484a3869..8d4ac0dfe 100755 --- a/.github/scripts/check-changelog.sh +++ b/.github/scripts/check-changelog.sh @@ -4,7 +4,7 @@ set -e CHANGELOG_FILE="changelog.md" -git fetch +git fetch origin $GITHUB_BASE_REF # Check if the changelog file was modified in the PR if git diff --name-only origin/$GITHUB_BASE_REF..$GITHUB_HEAD_REF | grep -q $CHANGELOG_FILE; then From c026bebe6ed1c9d89aaaa9493d62cacd98af6d4a Mon Sep 17 00:00:00 2001 From: carsakiller Date: Thu, 23 May 2024 08:08:01 +0000 Subject: [PATCH 03/10] fetch again? --- .github/scripts/check-changelog.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/scripts/check-changelog.sh b/.github/scripts/check-changelog.sh index 8d4ac0dfe..af39a4da4 100755 --- a/.github/scripts/check-changelog.sh +++ b/.github/scripts/check-changelog.sh @@ -5,6 +5,7 @@ set -e CHANGELOG_FILE="changelog.md" git fetch origin $GITHUB_BASE_REF +git fetch # Check if the changelog file was modified in the PR if git diff --name-only origin/$GITHUB_BASE_REF..$GITHUB_HEAD_REF | grep -q $CHANGELOG_FILE; then From d57084e877582817de8b0545d0f70ff0e86a3bf8 Mon Sep 17 00:00:00 2001 From: carsakiller Date: Thu, 23 May 2024 08:12:18 +0000 Subject: [PATCH 04/10] add: logging --- .github/scripts/check-changelog.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/scripts/check-changelog.sh b/.github/scripts/check-changelog.sh index af39a4da4..876d74f17 100755 --- a/.github/scripts/check-changelog.sh +++ b/.github/scripts/check-changelog.sh @@ -4,8 +4,12 @@ set -e CHANGELOG_FILE="changelog.md" + git fetch origin $GITHUB_BASE_REF -git fetch +git fetch --unshallow + +echo $(git remote) +echo $(git branch) # Check if the changelog file was modified in the PR if git diff --name-only origin/$GITHUB_BASE_REF..$GITHUB_HEAD_REF | grep -q $CHANGELOG_FILE; then From 3448f5e44c0fd9dbf15ebbbbae6994b9973a31ab Mon Sep 17 00:00:00 2001 From: carsakiller Date: Thu, 23 May 2024 08:13:16 +0000 Subject: [PATCH 05/10] un-unshallow --- .github/scripts/check-changelog.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/check-changelog.sh b/.github/scripts/check-changelog.sh index 876d74f17..aeec5aa19 100755 --- a/.github/scripts/check-changelog.sh +++ b/.github/scripts/check-changelog.sh @@ -6,7 +6,7 @@ CHANGELOG_FILE="changelog.md" git fetch origin $GITHUB_BASE_REF -git fetch --unshallow +git fetch echo $(git remote) echo $(git branch) From 5a97a63cf7c607c4bce4f5e56732a44451e73e1a Mon Sep 17 00:00:00 2001 From: carsakiller Date: Thu, 23 May 2024 08:19:08 +0000 Subject: [PATCH 06/10] don't fetch as deep --- .github/scripts/check-changelog.sh | 3 +-- .github/workflows/changelog.yml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/scripts/check-changelog.sh b/.github/scripts/check-changelog.sh index aeec5aa19..32489144b 100755 --- a/.github/scripts/check-changelog.sh +++ b/.github/scripts/check-changelog.sh @@ -8,8 +8,7 @@ CHANGELOG_FILE="changelog.md" git fetch origin $GITHUB_BASE_REF git fetch -echo $(git remote) -echo $(git branch) +echo $(git branch -a) # Check if the changelog file was modified in the PR if git diff --name-only origin/$GITHUB_BASE_REF..$GITHUB_HEAD_REF | grep -q $CHANGELOG_FILE; then diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index ccf936458..0f6a0dc45 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -13,7 +13,7 @@ jobs: - name: Checkout code uses: actions/checkout@v3 with: - fetch-depth: 0 # Need entire git history + fetch-depth: 2 - name: Set up environment run: | From 503da3b4c073573ce89f706debebd12a8a5abf98 Mon Sep 17 00:00:00 2001 From: carsakiller Date: Thu, 23 May 2024 08:27:10 +0000 Subject: [PATCH 07/10] or ref name --- .github/workflows/changelog.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 0f6a0dc45..9ed6968e9 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -13,11 +13,11 @@ jobs: - name: Checkout code uses: actions/checkout@v3 with: - fetch-depth: 2 + fetch-depth: 0 - name: Set up environment run: | - echo "GITHUB_HEAD_REF=${{ github.head_ref }}" >> $GITHUB_ENV + echo "GITHUB_HEAD_REF=${{ github.head_ref || github.ref_name }}" >> $GITHUB_ENV echo "GITHUB_BASE_REF=${{ github.base_ref }}" >> $GITHUB_ENV - name: Check if changelog is updated From 047c3a277ebdbbd5e67fae764d2d626df698e8b5 Mon Sep 17 00:00:00 2001 From: carsakiller Date: Thu, 23 May 2024 08:28:42 +0000 Subject: [PATCH 08/10] only ref name --- .github/scripts/check-changelog.sh | 2 +- .github/workflows/changelog.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/check-changelog.sh b/.github/scripts/check-changelog.sh index 32489144b..5402f4905 100755 --- a/.github/scripts/check-changelog.sh +++ b/.github/scripts/check-changelog.sh @@ -11,7 +11,7 @@ git fetch echo $(git branch -a) # Check if the changelog file was modified in the PR -if git diff --name-only origin/$GITHUB_BASE_REF..$GITHUB_HEAD_REF | grep -q $CHANGELOG_FILE; then +if git diff --name-only origin/$GITHUB_BASE_REF..$GITHUB_SOURCE_REF | grep -q $CHANGELOG_FILE; then echo "Thank you for updating the changelog!" exit 0 else diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 9ed6968e9..b3995e050 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -17,7 +17,7 @@ jobs: - name: Set up environment run: | - echo "GITHUB_HEAD_REF=${{ github.head_ref || github.ref_name }}" >> $GITHUB_ENV + echo "GITHUB_SOURCE_REF=${{ github.ref_name }}" >> $GITHUB_ENV echo "GITHUB_BASE_REF=${{ github.base_ref }}" >> $GITHUB_ENV - name: Check if changelog is updated From f6d3af8d34875ce073bb78e2f50bf1bc2b151a87 Mon Sep 17 00:00:00 2001 From: carsakiller Date: Thu, 23 May 2024 08:30:05 +0000 Subject: [PATCH 09/10] add prefix --- .github/scripts/check-changelog.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/check-changelog.sh b/.github/scripts/check-changelog.sh index 5402f4905..d6887bc1a 100755 --- a/.github/scripts/check-changelog.sh +++ b/.github/scripts/check-changelog.sh @@ -11,7 +11,7 @@ git fetch echo $(git branch -a) # Check if the changelog file was modified in the PR -if git diff --name-only origin/$GITHUB_BASE_REF..$GITHUB_SOURCE_REF | grep -q $CHANGELOG_FILE; then +if git diff --name-only origin/$GITHUB_BASE_REF..remotes/pull/$GITHUB_SOURCE_REF | grep -q $CHANGELOG_FILE; then echo "Thank you for updating the changelog!" exit 0 else From 75ed0bfacfee29f54cdab6b1218f0e48677a1fe6 Mon Sep 17 00:00:00 2001 From: carsakiller Date: Thu, 23 May 2024 08:31:36 +0000 Subject: [PATCH 10/10] add: unreleased section to changelog --- .github/scripts/check-changelog.sh | 3 --- changelog.md | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/scripts/check-changelog.sh b/.github/scripts/check-changelog.sh index d6887bc1a..ae3b8b11e 100755 --- a/.github/scripts/check-changelog.sh +++ b/.github/scripts/check-changelog.sh @@ -4,12 +4,9 @@ set -e CHANGELOG_FILE="changelog.md" - git fetch origin $GITHUB_BASE_REF git fetch -echo $(git branch -a) - # Check if the changelog file was modified in the PR if git diff --name-only origin/$GITHUB_BASE_REF..remotes/pull/$GITHUB_SOURCE_REF | grep -q $CHANGELOG_FILE; then echo "Thank you for updating the changelog!" diff --git a/changelog.md b/changelog.md index 85c073d71..62ca89749 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # changelog +## Unreleased + + ## 3.9.0 `2024-5-11` * `NEW` goto implementation @@ -123,7 +126,7 @@ Cat = 1, Dog = 2, } - + ---@param animal userdata ---@param atp AnimalType ---@return boolean