Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ads/fix workflow automation indentation #295

101 changes: 55 additions & 46 deletions .github/workflows/issue-triage.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: Ads - Triage OWASP Top 10 LLM Apps Issues

on:
issues:
types: [opened, labeled, reopened]

env:
BOARD_NAME: "OWASP Top 10 for LLM Applications"
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
ISSUE: ${{ github.event.issue.number }}
PROJECT_TECH_LEAD: "GangGreenTemperTatum"
LLM01_LEAD: "leondz"
LLM02_LEAD: "kenhuangus"
Expand All @@ -21,14 +29,10 @@ env:
WEB_DEVS: "mkfnch,rossja,GangGreenTemperTatum"
SEC_GOVERNANCE: "subzer0girl2"

on:
issues:
types: [opened, labeled]

jobs:
welcomes:
runs-on: ubuntu-latest
if: issues.types == 'opened'
if: contains(github.event.issue.labels.*.name, 'opened')
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand All @@ -45,54 +49,59 @@ jobs:

triage:
runs-on: ubuntu-latest
if: issues.types == 'labeled'
if: contains(github.event.issue.labels.*.name, 'labeled')
steps:
- name: Checkout repository
uses: actions/checkout@v2

- uses: actions/github-script@v7
with:
script: |
const issue = context.payload.issue;
const labels = issue.labels.map(label => label.name);
const assignees = [];
script: |
try {
const issue = context.payload.issue;
const labels = issue.labels.map(label => label.name);
const assignees = [];

// Label-to-assignee mappings
const labelAssigneeMap = {
'bug': [${{ env.PROJECT_TECH_LEAD }}],
'extension': [${{ env.PROJECT_TECH_LEAD }}],
'llm-other': [${{ env.PROJECT_TECH_LEAD }}],
'diagram': [${{ env.PROJECT_TECH_LEAD }}],
'pdf': [${{ env.DESIGN }}],
'website': [${{ env.WEB_DEVS }}],
'llm-01': [${{ env.LLM01_LEAD }}],
'llm-02': [${{ env.LLM02_LEAD }}],
'llm-03': [${{ env.LLM03_LEAD }}],
'llm-04': [${{ env.LLM04_LEAD }}],
'llm-05': [${{ env.LLM05_LEAD }}],
'llm-06': [${{ env.LLM06_LEAD }}],
'llm-07': [${{ env.LLM07_LEAD }}],
'llm-08': [${{ env.LLM08_LEAD }}],
'llm-09': [${{ env.LLM09_LEAD }}],
'llm-10': [${{ env.LLM10_LEAD }}]
};
// Label-to-assignee mappings
const labelAssigneeMap = {
'bug': [${{ env.PROJECT_TECH_LEAD }}],
'extension': [${{ env.PROJECT_TECH_LEAD }}],
'llm-other': [${{ env.PROJECT_TECH_LEAD }}],
'diagram': [${{ env.PROJECT_TECH_LEAD }}],
'pdf': [${{ env.DESIGN }}],
'website': [${{ env.WEB_DEVS }}],
'llm-01': [${{ env.LLM01_LEAD }}],
'llm-02': [${{ env.LLM02_LEAD }}],
'llm-03': [${{ env.LLM03_LEAD }}],
'llm-04': [${{ env.LLM04_LEAD }}],
'llm-05': [${{ env.LLM05_LEAD }}],
'llm-06': [${{ env.LLM06_LEAD }}],
'llm-07': [${{ env.LLM07_LEAD }}],
'llm-08': [${{ env.LLM08_LEAD }}],
'llm-09': [${{ env.LLM09_LEAD }}],
'llm-10': [${{ env.LLM10_LEAD }}]
};

// Check labels and assign based on mappings
labels.forEach(label => {
if (labelAssigneeMap[label]) {
assignees.push(...labelAssigneeMap[label]);
}
});
// Check labels and assign based on mappings
labels.forEach(label => {
if (labelAssigneeMap[label]) {
assignees.push(...labelAssigneeMap[label]);
}
});

// Remove duplicates from assignees list
// const uniqueAssignees = [...new Set(assignees)];
// Remove duplicates from assignees list
// const uniqueAssignees = [...new Set(assignees)];

// Assign the issue to the calculated assignees
await github.issues.addAssignees({
issue_number: issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
assignees: uniqueAssignees
});
env:
GITHUB_TOKEN: ${{ secrets.ADS_OWASP_LLM_APPS_REPO_TOKEN }}
// Assign the issue to the calculated assignees
await github.issues.addAssignees({
issue_number: issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
assignees: uniqueAssignees
});
} catch (error) {
console.error(error.message);
process.exit(1);
}
env:
GITHUB_TOKEN: ${{ secrets.ADS_OWASP_LLM_APPS_REPO_TOKEN }}