From eca6e8a936b9efb8a4049fe7ec836e8a8fb1c4b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kiner-tang=28=E6=96=87=E8=BE=89=29?= <1127031143@qq.com> Date: Fri, 29 Dec 2023 15:39:25 +0800 Subject: [PATCH] chore: changeset check --- .changeset/yellow-pugs-admire.md | 9 ++++ .github/workflows/changeset-check.yml | 61 +++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 .changeset/yellow-pugs-admire.md create mode 100644 .github/workflows/changeset-check.yml diff --git a/.changeset/yellow-pugs-admire.md b/.changeset/yellow-pugs-admire.md new file mode 100644 index 000000000..c9f0fd06a --- /dev/null +++ b/.changeset/yellow-pugs-admire.md @@ -0,0 +1,9 @@ +--- +'@ant-design/web3-assets': major +'@ant-design/web3-common': minor +'@ant-design/web3-icons': patch +'@ant-design/web3-wagmi': patch +'@ant-design/web3': patch +--- + +chore: ONLY FOR TEST CI, DO NOT MERGE diff --git a/.github/workflows/changeset-check.yml b/.github/workflows/changeset-check.yml new file mode 100644 index 000000000..3c7a822aa --- /dev/null +++ b/.github/workflows/changeset-check.yml @@ -0,0 +1,61 @@ +name: PR Changeset Check + +on: + pull_request: + types: + - opened + - synchronize + +jobs: + check_changeset: + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Check for major changes + run: | + changed_files=$(git diff --name-only HEAD..HEAD~1) + major_changes=$(echo "$changed_files" | grep ".changeset" | grep -c "major") + + if [ "$major_changes" -gt 0 ]; then + comment="@${{ github.actor }}, 本次 PR 的更改包含 major 变更,请确认是否符合预期。" + echo "$comment" > comment_body.txt + echo "comment=$comment" >> $GITHUB_OUTPUT + else + echo "comment=" >> $GITHUB_OUTPUT + fi + + # Save PR id to output + - name: save PR id + id: pr + run: echo "id=$(> $GITHUB_OUTPUT + + add_comment: + needs: check_changeset + runs-on: ubuntu-latest + if: ${{ needs.check_changeset.outputs.comment != '' }} + + steps: + - name: update status comment + uses: actions-cool/maintain-one-comment@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + body: ${{ needs.check_changeset.outputs.comment }} + body-include: '' + number: ${{ steps.pr.outputs.id }} + + delete_comment: + needs: check_changeset + runs-on: ubuntu-latest + if: ${{ needs.check_changeset.outputs.comment == '' }} + + steps: + - name: Delete comment + uses: actions-cool/maintain-one-comment@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + body-include: '' + number: ${{ steps.pr.outputs.id }} + delete: true