From eca80d5a4cff0c6e5dbe6108607257e39a4da594 Mon Sep 17 00:00:00 2001 From: Rock Chin <1010553892@qq.com> Date: Fri, 31 Mar 2023 07:18:08 +0000 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0cmdpriv-template.json?= =?UTF-8?q?=E7=9A=84=E8=87=AA=E5=8A=A8=E5=8C=96=E7=94=9F=E6=88=90=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/update-cmdpriv-template.yml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/update-cmdpriv-template.yml diff --git a/.github/workflows/update-cmdpriv-template.yml b/.github/workflows/update-cmdpriv-template.yml new file mode 100644 index 00000000..1dc617af --- /dev/null +++ b/.github/workflows/update-cmdpriv-template.yml @@ -0,0 +1,48 @@ +name: Update cmdpriv-template + +on: + push: + paths: + - 'pkg/qqbot/cmds/**' + pull_request: + types: [closed] + paths: + - 'pkg/qqbot/cmds/**' + +jobs: + update-cmdpriv-template: + if: github.event.pull_request.merged == true || github.event_name == 'push' + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.x + + - name: Install dependencies + run: pip install -r requirements.txt + + - name: Run generate_cmdpriv_template.py + run: python3 generate_cmdpriv_template.py + + - name: Check for changes in cmdpriv-template.json + id: check_changes + run: | + if git diff --name-only | grep -q "cmdpriv-template.json"; then + echo "::set-output name=changes_detected::true" + else + echo "::set-output name=changes_detected::false" + fi + + - name: Commit changes to cmdpriv-template.json + if: steps.check_changes.outputs.changes_detected == 'true' + run: | + git config --global user.name "GitHub Actions Bot" + git config --global user.email "" + git add cmdpriv-template.json + git commit -m "Update cmdpriv-template.json" + git push