From b11ebdd16b85564366fdc9a06e0643b6c0a63aa5 Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Fri, 28 Aug 2026 08:39:57 +0200 Subject: [PATCH] ci: added smallbot --- .github/workflows/smallbot.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/smallbot.yml diff --git a/.github/workflows/smallbot.yml b/.github/workflows/smallbot.yml new file mode 100644 index 0000000..2c0f194 --- /dev/null +++ b/.github/workflows/smallbot.yml @@ -0,0 +1,31 @@ +name: SmallBot +on: + issue_comment: + types: [created] +jobs: + bot: + if: startsWith(github.event.comment.body, 'smallbot! ') + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Match command + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMMENT: ${{ github.event.comment.body }} + USER: ${{ github.event.comment.user.login }} + ISSUE: ${{ github.event.issue.number }} + run: | + COMMAND="${COMMENT#smallbot! }" + if [ "$COMMAND" = "assign" ]; then + COUNT=$(gh issue view "$ISSUE" --json assignees --jq '.assignees | length') + if [ "$COUNT" -eq 0 ]; then + gh issue edit "$ISSUE" --add-assignee "$USER" + fi + fi + if [ "$COMMAND" = "unassign" ]; then + ASSIGNED=$(gh issue view "$ISSUE" --json assignees --jq "[.assignees[].login] | index(\"$USER\")") + if [ "$ASSIGNED" != "null" ]; then + gh issue edit "$ISSUE" --remove-assignee "$USER" + fi + fi \ No newline at end of file