Loading of Applications in AOBApplications causes latency #47
This file contains hidden or 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: Link DevOps via Comment | |
| on: | |
| issue_comment: | |
| types: [created] | |
| jobs: | |
| link-devops: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Process DevOps Link Command | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const comment = context.payload.comment.body.trim(); | |
| const issue_number = context.payload.issue.number; | |
| const actor = context.actor; | |
| console.log("Workflow triggered!"); | |
| console.log("Comment body:", context.payload.comment.body); | |
| console.log("Actor:", context.actor); | |
| // Only allow specific users to link DevOps items | |
| const allowedUsers = ["Mathnstein", "Martina-Graeber-One-Identity", "hannoquest", "kovtib", "SebastianWeberQuest"]; | |
| if (!allowedUsers.includes(actor)) { | |
| console.log("User unauthorized") | |
| return; // Ignore if unauthorized | |
| } | |
| // Check for command pattern | |
| const match = comment.match(/\/link-devops\s+(\d{6})/i); | |
| if (!match) { | |
| console.log("No matching regex") | |
| return; | |
| } | |
| const devopsId = match[1]; | |
| const labelName = `DevOps:${devopsId}`; | |
| // Get existing labels in repo | |
| const labels = await github.rest.issues.listLabelsForRepo(context.repo); | |
| // Create label if missing | |
| if (!labels.data.some(l => l.name === labelName)) { | |
| await github.rest.issues.createLabel({ | |
| ...context.repo, | |
| name: labelName, | |
| color: "B60205", | |
| description: `Linked to internal DevOps issue #${devopsId}` | |
| }); | |
| } | |
| // Add label to issue | |
| await github.rest.issues.addLabels({ | |
| ...context.repo, | |
| issue_number, | |
| labels: [labelName] | |
| }); | |
| // confirmation comment | |
| await github.rest.issues.createComment({ | |
| ...context.repo, | |
| issue_number, | |
| body: `✅ DevOps work item #${devopsId} linked and label added by @${actor}. Closing this issue - keep an eye out for branch syncing to resolve this work item.` | |
| }); | |
| // close issue until we have a workflow to handle updating from syncing | |
| await github.rest.issues.update({ | |
| ...context.repo, | |
| issue_number, | |
| state: "closed" | |
| }); |