From d888b0c712e66cc1a48568620ccdc16aaa1f9d41 Mon Sep 17 00:00:00 2001 From: Ads Dawson <104169244+GangGreenTemperTatum@users.noreply.github.com> Date: Sat, 13 Apr 2024 23:48:41 -0400 Subject: [PATCH] Ads/workflow automation fix (#294) * feat: kickoff v2 0 dir and files * fix: fixup workflow --- .github/workflows/issue-triage.yml | 137 +++++++++++++++-------------- 1 file changed, 72 insertions(+), 65 deletions(-) diff --git a/.github/workflows/issue-triage.yml b/.github/workflows/issue-triage.yml index 689d91e4..908c37d0 100644 --- a/.github/workflows/issue-triage.yml +++ b/.github/workflows/issue-triage.yml @@ -1,33 +1,34 @@ name: Ads - Triage OWASP Top 10 LLM Apps Issues +env: + PROJECT_TECH_LEAD: "GangGreenTemperTatum" + LLM01_LEAD: "leondz" + LLM02_LEAD: "kenhuangus" + LLM03_LEAD: "GangGreenTemperTatum" + LLM04_LEAD: "kenhuangus" + LLM05_LEAD: "jsotiro" + LLM06_LEAD: "GangGreenTemperTatum" + LLM07_LEAD: "rot169" + LLM08_LEAD: "virtualsteve-star" + LLM09_LEAD: "jsotiro" + LLM10_LEAD: "GangGreenTemperTatum" + PR_LEAD: "faceplate27" + POSTMASTER: "TBC" + TRANSLATIONS: "talesh" + DATA_GATHERING: "emmanuelgjr" + DESIGN: "rossja" + DIAGRAMS: "TBC" + WEB_DEVS: "mkfnch,rossja,GangGreenTemperTatum" + SEC_GOVERNANCE: "subzer0girl2" + on: issues: - types: [opened, labeled, reopened] - -env: - PROJECT_TECH_LEAD: 'GangGreenTemperTatum' - LLM01_LEAD: 'leondz' - LLM02_LEAD: 'kenhuangus' - LLM03_LEAD: 'GangGreenTemperTatum' - LLM04_LEAD: 'kenhuangus' - LLM05_LEAD: 'jsotiro' - LLM06_LEAD: 'GangGreenTemperTatum' - LLM07_LEAD: 'rot169' - LLM08_LEAD: 'virtualsteve-star' - LLM09_LEAD: 'jsotiro' - LLM10_LEAD: 'GangGreenTemperTatum' - PR_LEAD: 'faceplate27' - POSTMASTER: 'TBC' - TRANSLATIONS: 'talesh' - DATA_GATHERING: 'emmanuelgjr' - DESIGN: 'rossja' - DIAGRAMS: 'TBC' - WEB_DEVS: 'mkfnch,rossja,GangGreenTemperTatum' - SEC_GOVERNANCE: 'subzer0girl2' + types: [opened, labeled] jobs: - assign: + welcomes: runs-on: ubuntu-latest + if: issues.types == 'opened' steps: - name: Checkout repository uses: actions/checkout@v2 @@ -42,50 +43,56 @@ jobs: body: '👋 Thanks for reporting! Please ensure labels are applied appropriately to the issue so that the workflow automation can triage this to the correct member of the core team' }) - - name: Triage issues based on labels - uses: actions/github-script@v4 + triage: + runs-on: ubuntu-latest + if: issues.types == '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: | + 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 + }); + env: + GITHUB_TOKEN: ${{ secrets.ADS_OWASP_LLM_APPS_REPO_TOKEN }}