diff --git a/.github/workflows/_watchdog.yaml b/.github/workflows/_watchdog.yaml new file mode 100644 index 000000000..527625d11 --- /dev/null +++ b/.github/workflows/_watchdog.yaml @@ -0,0 +1,43 @@ +name: watchdog + +on: + issue_comment: + types: [created] + +jobs: + woof: + runs-on: ubuntu-22.04 + if: > + github.event_name == 'issue_comment' && + github.event.issue.pull_request && + startsWith(github.event.comment.body, '/ci') + steps: + - name: Get PR number + shell: bash + id: get-pr-num + run: | + PR_URL="${{ github.event.issue.pull_request.url }}" + PR_NUM=${PR_URL##*/} + echo "pr_number=$PR_NUM" >> $GITHUB_OUTPUT + + - name: Get Pull Request Information + uses: actions/github-script@v6 + id: get-pr-branch + with: + result-encoding: string + script: | + const pr = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: ${{ steps.get-pr-num.outputs.pr_number }} + }); + console.log('Pull Request Information:', pr.data); + return pr.data.head.ref; + + - name: Workflow Dispatch and wait + uses: aurelien-baudet/workflow-dispatch@v2.1.1 + with: + workflow: "CI" + token: ${{ secrets.TOKEN }} + wait-for-completion: false + ref: ${{ steps.get-pr-branch.outputs.result }}