[BUSINESS PROCESS]: Report an injury or illness #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Automatic Issue Assignment | |
on: | |
issues: | |
types: [opened] | |
jobs: | |
assign: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Assign issue based on business process | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
const issueBody = context.payload.issue.body; | |
const processMap = { | |
//'Acquire to dispose': 'Harshad', | |
//'Administer to operate': 'Harsh', | |
//'Case to resolution': 'Vinoth', | |
//'Concept to market': 'Jinal', | |
//'Design to retire': 'Alejandra', | |
'Forecast to plan': 'riblack-microsoft', | |
//'Hire to retire': 'Priyanka', | |
//'Inventory to deliver': 'Nicole', | |
//'Order to cash': 'Nikhil', | |
//'Plan to produce': 'Phillip', | |
'Procure to pay': 'AdiVijayashankar', | |
//'Project to profit': 'Lalitha', | |
//'Prospect to quote': 'Kody', | |
'Record to report': 'kgiardini', | |
'Service to cash': 'Dean-Hardy' | |
}; | |
const match = /End-to-End Business Process.*\n.*\[(.*)\]/i.exec(issueBody); | |
const selectedProcess = match ? match[1].trim() : null; | |
const assignee = processMap[selectedProcess]; | |
if (assignee) { | |
github.issues.addAssignees({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.payload.issue.number, | |
assignees: [assignee] | |
}); | |
} | |