Skip to content

Commit

Permalink
chore: issue review process (#328)
Browse files Browse the repository at this point in the history
  • Loading branch information
mghilardelli authored Oct 25, 2024
1 parent d44a434 commit 1f4878c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/business-story.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ Als <Rolle> möchte ich <Funktion>, damit <Nutzen>.
- ...
## Durchführung:
- ...
## Team Review
- [ ] <!-- check-ba -->BA Review
- [ ] <!-- check-dev -->DEV Review
- [ ] <!-- check-po -->PO Review
41 changes: 41 additions & 0 deletions .github/workflows/story-review.yml
Original file line number Diff line number Diff line change
@@ -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 = ["<!-- check-ba -->BA Review", "<!-- check-dev -->DEV Review", "<!-- check-po -->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
});
}
}

0 comments on commit 1f4878c

Please sign in to comment.