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