Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions .github/scripts/agent-scan-label-pr.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,29 @@ import * as core from '@actions/core';
import * as github from '@actions/github';

/**
* agent scan classification rename
* agent scan classification name
* - organic -> human
* - automated
* - mixed
*/
const CLASSIFICATION_MAP = {
organic: 'human',
automation: 'automated',
};

async function main() {
const classification = core.getInput('classification', { required: true });
const token = core.getInput('token', { required: true });
const isCommunityFlagged = core.getInput('community-flagged') === 'true';

const octokit = github.getOctokit(token);
const prNumber = github.context.payload.pull_request.number;

const labels = [`agent-scan:${CLASSIFICATION_MAP[classification] ?? classification}`];
if (isCommunityFlagged) {
labels.push('agent-scan:community-flagged');
if (classification === 'organic') {
const labels = [`agent-scan:${CLASSIFICATION_MAP[classification] ?? classification}`];

await octokit.rest.issues.addLabels({
...github.context.repo,
issue_number: prNumber,
labels: labels,
});
}
await octokit.rest.issues.addLabels({
...github.context.repo,
issue_number: prNumber,
labels: labels,
});
}

main().catch((error) => {
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/agent-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,15 @@ jobs:
- name: AgentScan
if: steps.membership.outputs.should-scan == 'true'
id: agentscan
uses: MatteoGabriele/agentscan-action@a584774dd15cabe6df4c6ab45fc43514a3b56b2d
uses: MatteoGabriele/agentscan-action@f41545309db947a68e22ed2643f182e754f4d41a # v1.8.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
agent-scan-comment: false
cache-path: .agentscan-cache
label-community-flagged: "agent-scan:community-flagged"
label-mixed: "agent-scan:mixed"
label-automation: "agent-scan:automated"

- name: Label PR with classification
if: steps.membership.outputs.should-scan == 'true' && steps.agentscan.outputs.classification
env:
Expand Down
Loading