From 1f4878c917e2803f568f8e9adeaa9148f6335401 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 25 Oct 2024 14:02:35 +0200 Subject: [PATCH] chore: issue review process (#328) --- .github/ISSUE_TEMPLATE/business-story.md | 4 +++ .github/workflows/story-review.yml | 41 ++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .github/workflows/story-review.yml diff --git a/.github/ISSUE_TEMPLATE/business-story.md b/.github/ISSUE_TEMPLATE/business-story.md index 2f93467b..a84918bf 100644 --- a/.github/ISSUE_TEMPLATE/business-story.md +++ b/.github/ISSUE_TEMPLATE/business-story.md @@ -21,3 +21,7 @@ Als möchte ich , damit . - ... ## Durchführung: - ... +## Team Review +- [ ] BA Review +- [ ] DEV Review +- [ ] PO Review diff --git a/.github/workflows/story-review.yml b/.github/workflows/story-review.yml new file mode 100644 index 00000000..edfa5eac --- /dev/null +++ b/.github/workflows/story-review.yml @@ -0,0 +1,41 @@ +name: Story Issue Checkbox + +on: + issues: + types: [ edited ] + +permissions: + issues: write + +jobs: + update-checkbox: + runs-on: ubuntu-latest + steps: + - name: Checkboxes + uses: actions/github-script@v6 + with: + script: | + const checkboxes = ["BA Review", "DEV Review", "PO Review"]; + const issueBody= context.payload.issue.body + const oldIssueBody = context.payload.changes.body.from + const username = context.actor; + for(const checkbox of checkboxes){ + if(issueBody.includes(`- [x] ${checkbox}`) && oldIssueBody.includes(`- [ ] ${checkbox}`)){ + const updatedBody = issueBody.replace(`- [x] ${checkbox}`, `- [x] ${checkbox} (@${username})`); + github.rest.issues.update({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: updatedBody + }); + } else if(issueBody.includes(`- [ ] ${checkbox}`) && oldIssueBody.includes(`- [x] ${checkbox}`)){ + const regex = new RegExp(`- \\[ \\] ${checkbox} \\(@[^)]+\\)`, 'g'); + const updatedBody = issueBody.replace(regex, `- [ ] ${checkbox}`); + github.rest.issues.update({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: updatedBody + }); + } + }