mirror of
https://github.com/github/awesome-copilot.git
synced 2026-06-13 11:33:32 +00:00
chore: publish from staged
This commit is contained in:
@@ -53,7 +53,7 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
result=$(node ./eng/external-plugin-intake.mjs "$GITHUB_EVENT_PATH")
|
||||
result=$(node ./eng/external-plugin-intake.mjs "$GITHUB_EVENT_PATH" "${{ github.run_id }}" "${{ github.repository_owner }}" "${{ github.event.repository.name }}")
|
||||
{
|
||||
echo 'result<<EOF'
|
||||
echo "$result"
|
||||
@@ -130,7 +130,7 @@ jobs:
|
||||
};
|
||||
}
|
||||
|
||||
finalResult = intake.applyQualityGateResult(baseResult, qualityResult);
|
||||
finalResult = intake.applyQualityGateResult(baseResult, qualityResult, context.runId, context.repo.owner, context.repo.repo);
|
||||
}
|
||||
|
||||
await intakeState.applyExternalPluginIntakeEvaluation({
|
||||
|
||||
@@ -102,7 +102,10 @@ jobs:
|
||||
|
||||
const baseResult = await intake.evaluateExternalPluginIssue({
|
||||
issue: currentIssue,
|
||||
token: process.env.GITHUB_TOKEN
|
||||
token: process.env.GITHUB_TOKEN,
|
||||
runId: context.runId,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo
|
||||
});
|
||||
|
||||
core.setOutput('should-run', 'true');
|
||||
@@ -173,7 +176,7 @@ jobs:
|
||||
};
|
||||
}
|
||||
|
||||
finalResult = intake.applyQualityGateResult(baseResult, qualityResult);
|
||||
finalResult = intake.applyQualityGateResult(baseResult, qualityResult, context.runId, context.repo.owner, context.repo.repo);
|
||||
}
|
||||
|
||||
await intakeState.applyExternalPluginIntakeEvaluation({
|
||||
|
||||
@@ -424,13 +424,14 @@ function getIntakeStateFromQualityResult(baseResult, qualityResult) {
|
||||
return "ready-for-review";
|
||||
}
|
||||
|
||||
function buildMergedIntakeComment(baseResult, qualityResult) {
|
||||
function buildMergedIntakeComment(baseResult, qualityResult, runId, owner, repo) {
|
||||
if (!baseResult.valid) {
|
||||
return baseResult.commentBody;
|
||||
}
|
||||
|
||||
const marker = baseResult.commentMarker ?? EXTERNAL_PLUGIN_INTAKE_COMMENT_MARKER;
|
||||
const qualitySection = buildQualityGatesCommentSection(qualityResult);
|
||||
const runLink = runId && owner && repo ? `_[View workflow run](https://github.com/${owner}/${repo}/actions/runs/${runId})_` : "";
|
||||
|
||||
const intro =
|
||||
qualityResult.failure_class === "submitter_fixes"
|
||||
@@ -467,10 +468,11 @@ function buildMergedIntakeComment(baseResult, qualityResult) {
|
||||
baseResult.warnings?.length
|
||||
? ["", "### Warnings", "", ...baseResult.warnings.map((warning) => `- ${warning}`)].join("\n")
|
||||
: "",
|
||||
runLink ? `\n${runLink}` : "",
|
||||
].filter(Boolean).join("\n");
|
||||
}
|
||||
|
||||
export function applyQualityGateResult(baseEvaluation, qualityGateResult) {
|
||||
export function applyQualityGateResult(baseEvaluation, qualityGateResult, runId, owner, repo) {
|
||||
const baseResult = typeof baseEvaluation === "string" ? JSON.parse(baseEvaluation) : baseEvaluation;
|
||||
const qualityResult = normalizeQualityGateResult(
|
||||
typeof qualityGateResult === "string" ? JSON.parse(qualityGateResult) : qualityGateResult,
|
||||
@@ -481,11 +483,11 @@ export function applyQualityGateResult(baseEvaluation, qualityGateResult) {
|
||||
...baseResult,
|
||||
qualityGates: qualityResult,
|
||||
intakeState,
|
||||
commentBody: buildMergedIntakeComment(baseResult, qualityResult),
|
||||
commentBody: buildMergedIntakeComment(baseResult, qualityResult, runId, owner, repo),
|
||||
};
|
||||
}
|
||||
|
||||
export async function evaluateExternalPluginIssue({ issue, token } = {}) {
|
||||
export async function evaluateExternalPluginIssue({ issue, token, runId, owner, repo } = {}) {
|
||||
const issueBody = issue?.body ?? "";
|
||||
const parsed = parseExternalPluginIssueBody(issueBody);
|
||||
const errors = [...parsed.errors];
|
||||
@@ -529,6 +531,8 @@ export async function evaluateExternalPluginIssue({ issue, token } = {}) {
|
||||
].join("\n")
|
||||
: "```json\n{}\n```";
|
||||
|
||||
const runLink = runId && owner && repo ? `_[View workflow run](https://github.com/${owner}/${repo}/actions/runs/${runId})_` : "";
|
||||
|
||||
const commentBody = valid
|
||||
? [
|
||||
marker,
|
||||
@@ -552,6 +556,7 @@ export async function evaluateExternalPluginIssue({ issue, token } = {}) {
|
||||
dedupedWarnings.length > 0
|
||||
? ["", "### Warnings", "", ...dedupedWarnings.map((warning) => `- ${warning}`)].join("\n")
|
||||
: "",
|
||||
runLink ? `\n${runLink}` : "",
|
||||
].filter(Boolean).join("\n")
|
||||
: [
|
||||
marker,
|
||||
@@ -566,6 +571,7 @@ export async function evaluateExternalPluginIssue({ issue, token } = {}) {
|
||||
dedupedWarnings.length > 0
|
||||
? ["", "### Warnings", "", ...dedupedWarnings.map((warning) => `- ${warning}`)].join("\n")
|
||||
: "",
|
||||
runLink ? `\n${runLink}` : "",
|
||||
].filter(Boolean).join("\n");
|
||||
|
||||
return {
|
||||
@@ -585,11 +591,14 @@ const isCli = process.argv[1] && fileURLToPath(import.meta.url) === path.resolve
|
||||
if (isCli) {
|
||||
const eventPath = process.argv[2];
|
||||
if (!eventPath) {
|
||||
console.error("Usage: node ./eng/external-plugin-intake.mjs <github-event.json>");
|
||||
console.error("Usage: node ./eng/external-plugin-intake.mjs <github-event.json> [runId] [owner] [repo]");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const event = JSON.parse(fs.readFileSync(eventPath, "utf8"));
|
||||
const result = await evaluateExternalPluginIssue({ issue: event.issue, token: process.env.GITHUB_TOKEN });
|
||||
const runId = process.argv[3];
|
||||
const owner = process.argv[4];
|
||||
const repo = process.argv[5];
|
||||
const result = await evaluateExternalPluginIssue({ issue: event.issue, token: process.env.GITHUB_TOKEN, runId, owner, repo });
|
||||
process.stdout.write(JSON.stringify(result));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user