Skip to content

Dependency Dashboard #117

Dependency Dashboard

Dependency Dashboard #117

Workflow file for this run

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@v7
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
});
}
}