From 8886e7d1e2773cfcfa461d46712889ba9b3633e0 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 6 Jan 2025 01:34:43 +0300 Subject: [PATCH] update --- .github/workflows/auto_commands.yml | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/auto_commands.yml diff --git a/.github/workflows/auto_commands.yml b/.github/workflows/auto_commands.yml new file mode 100644 index 0000000..80e5ec5 --- /dev/null +++ b/.github/workflows/auto_commands.yml @@ -0,0 +1,43 @@ +name: Auto AI Commands + +on: + pull_request: + types: [opened, reopened, synchronize] + pull_request_target: + types: [opened, reopened, synchronize] + +jobs: + check-and-comment: + runs-on: ubuntu-latest + permissions: + pull-requests: write + issues: write + + steps: + - name: Check PR status and comment + uses: actions/github-script@v6 + with: + script: | + const pr = context.payload.pull_request; + + // Check if PR has conflicts + if (pr.mergeable === false) { + console.log('PR has conflicts, commenting /ai resolve'); + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.number, + body: '/ai resolve' + }); + } + + // Check if PR title starts with "updated" + if (pr.title.toLowerCase().startsWith('updated')) { + console.log('PR title starts with "updated", commenting /ai suggest title'); + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.number, + body: '/ai suggest title' + }); + } \ No newline at end of file