fix: add concurrency protection to action sync workflows (#451)
* fix: add concurrency protection to action sync workflows * style: fix formatting in action/modes.ts --------- Co-authored-by: pullfrog[bot] <226033991+pullfrog[bot]@users.noreply.github.com>
This commit is contained in:
committed by
pullfrog[bot]
parent
5684cbef77
commit
8bac460177
@@ -149592,7 +149592,7 @@ function ResolveReviewThreadTool(ctx) {
|
||||
// mcp/selectMode.ts
|
||||
var SelectModeParams = type({
|
||||
mode: type.string.describe(
|
||||
"the name of the mode to select (e.g., 'Build', 'Plan', 'Review', 'IncrementalReview', 'Fix', 'AddressReviews', 'Task')"
|
||||
"the name of the mode to select (e.g., 'Build', 'Plan', 'Review', 'IncrementalReview', 'Fix', 'AddressReviews', 'Task', 'ResolveConflicts')"
|
||||
)
|
||||
});
|
||||
function resolveMode(modes2, modeName) {
|
||||
@@ -149629,6 +149629,36 @@ var modeGuidance = {
|
||||
For simple, well-defined tasks, a single build subagent is sufficient \u2014 skip the plan and review phases.
|
||||
|
||||
Your subagent receives ONLY what you write. Include file paths, constraints, conventions, and any context from AGENTS.md or the codebase directly in the prompt. Subagents have file ops, shell, and read-only GitHub tools \u2014 but NO git/checkout, dependency, GitHub-write, or remote-mutating tools.`,
|
||||
ResolveConflicts: `### Checklist
|
||||
|
||||
1. **Setup**:
|
||||
- Call \${ghPullfrogMcpName}/checkout_pr to get the PR branch.
|
||||
- Call \${ghPullfrogMcpName}/get_pull_request to identify the base branch (e.g., 'main').
|
||||
- Call \${ghPullfrogMcpName}/git_fetch to fetch the base branch.
|
||||
|
||||
2. **Merge Attempt**:
|
||||
- Run \`git merge origin/<base_branch>\` via shell.
|
||||
- If it succeeds automatically: Great! Push via \${ghPullfrogMcpName}/push_branch and report success.
|
||||
- If it fails (conflicts): You must resolve them.
|
||||
|
||||
3. **Delegation (if conflicts exist)**:
|
||||
- Run \`git status\` or parse the merge output to find the list of conflicting files.
|
||||
- Delegate to a subagent (or multiple in parallel if many files) to resolve the conflicts.
|
||||
- **Instructions for subagent**:
|
||||
- "You are resolving merge conflicts in these files: [list]."
|
||||
- "For each file: read it, find the conflict markers (<<<<<<<, =======, >>>>>>>), understand the code context, and rewrite the file with the correct resolution. Remove all markers."
|
||||
- "After resolving, verify the file syntax is correct."
|
||||
- "Call \${ghPullfrogMcpName}/set_output with a summary of what you resolved."
|
||||
- Note: Subagents cannot run git commands. They only edit the files.
|
||||
|
||||
4. **Finalize**:
|
||||
- After subagents return:
|
||||
- Run a final verification (build/test) to ensure the resolution works.
|
||||
- \`git add .\`
|
||||
- \`git commit -m "Resolve merge conflicts"\`
|
||||
- \${ghPullfrogMcpName}/push_branch
|
||||
- \${ghPullfrogMcpName}/report_progress
|
||||
`,
|
||||
AddressReviews: `### Checklist
|
||||
|
||||
1. Before delegating, checkout the PR branch yourself via \`${ghPullfrogMcpName}/checkout_pr\` \u2014 subagents have no git/checkout tools.
|
||||
@@ -150523,6 +150553,38 @@ ${permalinkTip}`
|
||||
10. **PROGRESS** - ${reportProgressInstruction}
|
||||
|
||||
Your job is to fix issues THIS PR introduced, not to fix all CI failures. If in doubt about causation, abort and explain rather than making speculative changes.`
|
||||
},
|
||||
{
|
||||
name: "ResolveConflicts",
|
||||
description: "Resolve merge conflicts in a PR branch against the base branch",
|
||||
prompt: `Follow these steps to resolve merge conflicts.
|
||||
|
||||
1. **CHECKOUT** - Call ${ghPullfrogMcpName}/checkout_pr with the PR number. This fetches the PR branch.
|
||||
|
||||
2. **FETCH BASE** - Identify the base branch (usually main or master) and fetch it using ${ghPullfrogMcpName}/git_fetch (e.g., ref: "main").
|
||||
|
||||
3. **ATTEMPT MERGE** - Use ${ghPullfrogMcpName}/shell to run \`git merge origin/<base_branch>\`.
|
||||
- If the merge succeeds (exit code 0), the branch is up to date. Push it and you're done.
|
||||
- If the merge fails, you have conflicts to resolve.
|
||||
|
||||
4. **IDENTIFY CONFLICTS** - Run \`git status\` to see which files are conflicting (modified by both).
|
||||
|
||||
5. **RESOLVE** - For each conflicting file:
|
||||
- Read the file to see the conflict markers (\`<<<<<<<\`, \`=======\`, \`>>>>>>>\`).
|
||||
- Determine the correct content. You may need to keep changes from both sides, or choose one.
|
||||
- Edit the file to apply the resolution and remove the markers.
|
||||
|
||||
6. **VERIFY** - ${dependencyInstallationStep}
|
||||
- Run tests/builds to ensure the resolution is correct.
|
||||
|
||||
7. **COMMIT** - Once all conflicts are resolved:
|
||||
- \`git add .\`
|
||||
- \`git commit -m "Merge branch <base_branch> into <pr_branch>"\` (or similar).
|
||||
|
||||
8. **PUSH** - Call ${ghPullfrogMcpName}/push_branch.
|
||||
|
||||
9. **PROGRESS** - ${reportProgressInstruction}
|
||||
`
|
||||
},
|
||||
{
|
||||
name: "Task",
|
||||
@@ -153659,17 +153721,13 @@ ${instructions.user}` : null,
|
||||
}
|
||||
await writeJobSummary(toolState);
|
||||
if (toolState.output) {
|
||||
log.info(`::pullfrog-output::${Buffer.from(toolState.output).toString("base64")}`);
|
||||
core5.setOutput("result", toolState.output);
|
||||
}
|
||||
const mainResult = await handleAgentResult({
|
||||
return await handleAgentResult({
|
||||
result,
|
||||
toolState,
|
||||
silent: payload.event.silent ?? false
|
||||
});
|
||||
return {
|
||||
...mainResult,
|
||||
result: toolState.output
|
||||
};
|
||||
} catch (_) {
|
||||
var _error = _, _hasError = true;
|
||||
} finally {
|
||||
@@ -153714,9 +153772,6 @@ async function run() {
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || "Agent execution failed");
|
||||
}
|
||||
if (result.result) {
|
||||
core6.setOutput("result", result.result);
|
||||
}
|
||||
} catch (error49) {
|
||||
const errorMessage = error49 instanceof Error ? error49.message : "Unknown error occurred";
|
||||
core6.setFailed(`Action failed: ${errorMessage}`);
|
||||
|
||||
Reference in New Issue
Block a user