3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-01 05:29:28 +00:00

update compiled workflows

This commit is contained in:
Don Syme 2025-09-17 23:47:16 +01:00
parent f300dfc425
commit d989bcaebe
7 changed files with 114 additions and 259 deletions

4
.github/workflows/ask.lock.yml generated vendored
View file

@ -2,7 +2,7 @@
# To update this file, edit the corresponding .md file and run:
# gh aw compile
#
# Effective stop-time: 2025-09-19 15:41:02
# Effective stop-time: 2025-09-19 22:46:19
name: "Question Answering Researcher"
on:
@ -1078,7 +1078,7 @@ jobs:
WORKFLOW_NAME="Question Answering Researcher"
# Check stop-time limit
STOP_TIME="2025-09-19 15:41:02"
STOP_TIME="2025-09-19 22:46:19"
echo "Checking stop-time limit: $STOP_TIME"
# Convert stop time to epoch seconds

36
.github/workflows/ci-doctor.lock.yml generated vendored
View file

@ -1,17 +1,12 @@
# This file was automatically generated by gh-aw. DO NOT EDIT.
# To update this file, edit the corresponding .md file and run:
# gh aw compile
#
# Effective stop-time: 2025-09-19 15:41:02
name: "CI Failure Doctor"
"on":
on:
workflow_run:
types:
- completed
workflows:
- Daily Perf Improver
- Daily Test Coverage Improver
permissions: {}
@ -552,35 +547,6 @@ jobs:
}
}
EOF
- name: Safety checks
run: |
set -e
echo "Performing safety checks before executing agentic tools..."
WORKFLOW_NAME="CI Failure Doctor"
# Check stop-time limit
STOP_TIME="2025-09-19 15:41:02"
echo "Checking stop-time limit: $STOP_TIME"
# Convert stop time to epoch seconds
STOP_EPOCH=$(date -d "$STOP_TIME" +%s 2>/dev/null || echo "invalid")
if [ "$STOP_EPOCH" = "invalid" ]; then
echo "Warning: Invalid stop-time format: $STOP_TIME. Expected format: YYYY-MM-DD HH:MM:SS"
else
CURRENT_EPOCH=$(date +%s)
echo "Current time: $(date)"
echo "Stop time: $STOP_TIME"
if [ "$CURRENT_EPOCH" -ge "$STOP_EPOCH" ]; then
echo "Stop time reached. Attempting to disable workflow to prevent cost overrun, then exiting."
gh workflow disable "$WORKFLOW_NAME"
echo "Workflow disabled. No future runs will be triggered."
exit 1
fi
fi
echo "All safety checks passed. Proceeding with agentic tool execution."
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create prompt
env:
GITHUB_AW_PROMPT: /tmp/aw-prompts/prompt.txt

View file

@ -1,12 +1,12 @@
---
on:
workflow_run:
workflows: ["Daily Perf Improver", "Daily Test Coverage Improver"]
#workflows: ["Daily Perf Improver", "Daily Test Coverage Improver"]
types:
- completed
# This will trigger only when the CI workflow completes with failure
# The condition is handled in the workflow body
stop-after: +48h
#stop-after: +48h
# Only trigger for failures - check in the workflow body
if: ${{ github.event.workflow_run.conclusion == 'failure' }}

View file

@ -2,7 +2,7 @@
# To update this file, edit the corresponding .md file and run:
# gh aw compile
#
# Effective stop-time: 2025-09-19 15:41:02
# Effective stop-time: 2025-09-19 22:46:19
name: "Daily Backlog Burner"
"on":
@ -539,7 +539,7 @@ jobs:
WORKFLOW_NAME="Daily Backlog Burner"
# Check stop-time limit
STOP_TIME="2025-09-19 15:41:02"
STOP_TIME="2025-09-19 22:46:19"
echo "Checking stop-time limit: $STOP_TIME"
# Convert stop time to epoch seconds
@ -2350,6 +2350,7 @@ jobs:
if: always()
env:
GITHUB_AW_SAFE_OUTPUTS: ${{ env.GITHUB_AW_SAFE_OUTPUTS }}
GITHUB_SHA: ${{ github.sha }}
run: |
# Check current git status
echo "Current git status:"
@ -2376,7 +2377,7 @@ jobs:
# Extract branch value using sed
BRANCH_NAME=$(echo "$line" | sed -n 's/.*"branch"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p')
if [ -n "$BRANCH_NAME" ]; then
echo "Extracted branch name from create-pull-request: $BRANCH_NAME"
echo "Extracted branch name from push-to-pr-branch: $BRANCH_NAME"
break
fi
fi
@ -2384,13 +2385,10 @@ jobs:
done < "$GITHUB_AW_SAFE_OUTPUTS"
fi
# Get the initial commit SHA from the base branch of the pull request
if [ "$GITHUB_EVENT_NAME" = "pull_request" ] || [ "$GITHUB_EVENT_NAME" = "pull_request_review_comment" ]; then
INITIAL_SHA="$GITHUB_BASE_REF"
else
INITIAL_SHA="$GITHUB_SHA"
# If no branch or branch doesn't exist, no patch
if [ -z "$BRANCH_NAME" ]; then
echo "No branch found, no patch generation"
fi
echo "Base commit SHA: $INITIAL_SHA"
# If we have a branch name, check if that branch exists and get its diff
if [ -n "$BRANCH_NAME" ]; then
@ -2398,47 +2396,26 @@ jobs:
# Check if the branch exists
if git show-ref --verify --quiet refs/heads/$BRANCH_NAME; then
echo "Branch $BRANCH_NAME exists, generating patch from branch changes"
# Generate patch from the base to the branch
git format-patch "$INITIAL_SHA".."$BRANCH_NAME" --stdout > /tmp/aw.patch || echo "Failed to generate patch from branch" > /tmp/aw.patch
echo "Patch file created from branch: $BRANCH_NAME"
# Check if origin/$BRANCH_NAME exists to use as base
if git show-ref --verify --quiet refs/remotes/origin/$BRANCH_NAME; then
echo "Using origin/$BRANCH_NAME as base for patch generation"
BASE_REF="origin/$BRANCH_NAME"
else
echo "origin/$BRANCH_NAME does not exist, using merge-base with default branch"
# Get the default branch name
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
echo "Default branch: $DEFAULT_BRANCH"
# Find merge base between default branch and current branch
BASE_REF=$(git merge-base origin/$DEFAULT_BRANCH $BRANCH_NAME)
echo "Using merge-base as base: $BASE_REF"
fi
# Generate patch from the determined base to the branch
git format-patch "$BASE_REF".."$BRANCH_NAME" --stdout > /tmp/aw.patch || echo "Failed to generate patch from branch" > /tmp/aw.patch
echo "Patch file created from branch: $BRANCH_NAME (base: $BASE_REF)"
else
echo "Branch $BRANCH_NAME does not exist, falling back to current HEAD"
BRANCH_NAME=""
fi
fi
# If no branch or branch doesn't exist, use the existing logic
if [ -z "$BRANCH_NAME" ]; then
echo "Using current HEAD for patch generation"
# Stage any unstaged files
git add -A || true
# Check if there are staged files to commit
if ! git diff --cached --quiet; then
echo "Staged files found, committing them..."
git commit -m "[agent] staged files" || true
echo "Staged files committed"
else
echo "No staged files to commit"
fi
# Check updated git status
echo "Updated git status after committing staged files:"
git status
# Show compact diff information between initial commit and HEAD (committed changes only)
echo '## Git diff' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
git diff --name-only "$INITIAL_SHA"..HEAD >> $GITHUB_STEP_SUMMARY || true
echo '```' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
# Check if there are any committed changes since the initial commit
if git diff --quiet "$INITIAL_SHA" HEAD; then
echo "No committed changes detected since initial commit"
echo "Skipping patch generation - no committed changes to create patch from"
else
echo "Committed changes detected, generating patch..."
# Generate patch from initial commit to HEAD (committed changes only)
git format-patch "$INITIAL_SHA"..HEAD --stdout > /tmp/aw.patch || echo "Failed to generate patch" > /tmp/aw.patch
echo "Patch file created at /tmp/aw.patch"
echo "Branch $BRANCH_NAME does not exist, no patch"
fi
fi

View file

@ -2,7 +2,7 @@
# To update this file, edit the corresponding .md file and run:
# gh aw compile
#
# Effective stop-time: 2025-09-19 15:41:02
# Effective stop-time: 2025-09-19 22:46:19
name: "Daily Perf Improver"
"on":
@ -553,7 +553,7 @@ jobs:
WORKFLOW_NAME="Daily Perf Improver"
# Check stop-time limit
STOP_TIME="2025-09-19 15:41:02"
STOP_TIME="2025-09-19 22:46:19"
echo "Checking stop-time limit: $STOP_TIME"
# Convert stop time to epoch seconds
@ -2425,6 +2425,7 @@ jobs:
if: always()
env:
GITHUB_AW_SAFE_OUTPUTS: ${{ env.GITHUB_AW_SAFE_OUTPUTS }}
GITHUB_SHA: ${{ github.sha }}
run: |
# Check current git status
echo "Current git status:"
@ -2451,7 +2452,7 @@ jobs:
# Extract branch value using sed
BRANCH_NAME=$(echo "$line" | sed -n 's/.*"branch"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p')
if [ -n "$BRANCH_NAME" ]; then
echo "Extracted branch name from create-pull-request: $BRANCH_NAME"
echo "Extracted branch name from push-to-pr-branch: $BRANCH_NAME"
break
fi
fi
@ -2459,13 +2460,10 @@ jobs:
done < "$GITHUB_AW_SAFE_OUTPUTS"
fi
# Get the initial commit SHA from the base branch of the pull request
if [ "$GITHUB_EVENT_NAME" = "pull_request" ] || [ "$GITHUB_EVENT_NAME" = "pull_request_review_comment" ]; then
INITIAL_SHA="$GITHUB_BASE_REF"
else
INITIAL_SHA="$GITHUB_SHA"
# If no branch or branch doesn't exist, no patch
if [ -z "$BRANCH_NAME" ]; then
echo "No branch found, no patch generation"
fi
echo "Base commit SHA: $INITIAL_SHA"
# If we have a branch name, check if that branch exists and get its diff
if [ -n "$BRANCH_NAME" ]; then
@ -2473,47 +2471,26 @@ jobs:
# Check if the branch exists
if git show-ref --verify --quiet refs/heads/$BRANCH_NAME; then
echo "Branch $BRANCH_NAME exists, generating patch from branch changes"
# Generate patch from the base to the branch
git format-patch "$INITIAL_SHA".."$BRANCH_NAME" --stdout > /tmp/aw.patch || echo "Failed to generate patch from branch" > /tmp/aw.patch
echo "Patch file created from branch: $BRANCH_NAME"
# Check if origin/$BRANCH_NAME exists to use as base
if git show-ref --verify --quiet refs/remotes/origin/$BRANCH_NAME; then
echo "Using origin/$BRANCH_NAME as base for patch generation"
BASE_REF="origin/$BRANCH_NAME"
else
echo "origin/$BRANCH_NAME does not exist, using merge-base with default branch"
# Get the default branch name
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
echo "Default branch: $DEFAULT_BRANCH"
# Find merge base between default branch and current branch
BASE_REF=$(git merge-base origin/$DEFAULT_BRANCH $BRANCH_NAME)
echo "Using merge-base as base: $BASE_REF"
fi
# Generate patch from the determined base to the branch
git format-patch "$BASE_REF".."$BRANCH_NAME" --stdout > /tmp/aw.patch || echo "Failed to generate patch from branch" > /tmp/aw.patch
echo "Patch file created from branch: $BRANCH_NAME (base: $BASE_REF)"
else
echo "Branch $BRANCH_NAME does not exist, falling back to current HEAD"
BRANCH_NAME=""
fi
fi
# If no branch or branch doesn't exist, use the existing logic
if [ -z "$BRANCH_NAME" ]; then
echo "Using current HEAD for patch generation"
# Stage any unstaged files
git add -A || true
# Check if there are staged files to commit
if ! git diff --cached --quiet; then
echo "Staged files found, committing them..."
git commit -m "[agent] staged files" || true
echo "Staged files committed"
else
echo "No staged files to commit"
fi
# Check updated git status
echo "Updated git status after committing staged files:"
git status
# Show compact diff information between initial commit and HEAD (committed changes only)
echo '## Git diff' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
git diff --name-only "$INITIAL_SHA"..HEAD >> $GITHUB_STEP_SUMMARY || true
echo '```' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
# Check if there are any committed changes since the initial commit
if git diff --quiet "$INITIAL_SHA" HEAD; then
echo "No committed changes detected since initial commit"
echo "Skipping patch generation - no committed changes to create patch from"
else
echo "Committed changes detected, generating patch..."
# Generate patch from initial commit to HEAD (committed changes only)
git format-patch "$INITIAL_SHA"..HEAD --stdout > /tmp/aw.patch || echo "Failed to generate patch" > /tmp/aw.patch
echo "Patch file created at /tmp/aw.patch"
echo "Branch $BRANCH_NAME does not exist, no patch"
fi
fi

View file

@ -2,7 +2,7 @@
# To update this file, edit the corresponding .md file and run:
# gh aw compile
#
# Effective stop-time: 2025-09-19 15:41:02
# Effective stop-time: 2025-09-19 22:46:19
name: "Daily Test Coverage Improver"
"on":
@ -553,7 +553,7 @@ jobs:
WORKFLOW_NAME="Daily Test Coverage Improver"
# Check stop-time limit
STOP_TIME="2025-09-19 15:41:02"
STOP_TIME="2025-09-19 22:46:19"
echo "Checking stop-time limit: $STOP_TIME"
# Convert stop time to epoch seconds
@ -2400,6 +2400,7 @@ jobs:
if: always()
env:
GITHUB_AW_SAFE_OUTPUTS: ${{ env.GITHUB_AW_SAFE_OUTPUTS }}
GITHUB_SHA: ${{ github.sha }}
run: |
# Check current git status
echo "Current git status:"
@ -2426,7 +2427,7 @@ jobs:
# Extract branch value using sed
BRANCH_NAME=$(echo "$line" | sed -n 's/.*"branch"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p')
if [ -n "$BRANCH_NAME" ]; then
echo "Extracted branch name from create-pull-request: $BRANCH_NAME"
echo "Extracted branch name from push-to-pr-branch: $BRANCH_NAME"
break
fi
fi
@ -2434,13 +2435,10 @@ jobs:
done < "$GITHUB_AW_SAFE_OUTPUTS"
fi
# Get the initial commit SHA from the base branch of the pull request
if [ "$GITHUB_EVENT_NAME" = "pull_request" ] || [ "$GITHUB_EVENT_NAME" = "pull_request_review_comment" ]; then
INITIAL_SHA="$GITHUB_BASE_REF"
else
INITIAL_SHA="$GITHUB_SHA"
# If no branch or branch doesn't exist, no patch
if [ -z "$BRANCH_NAME" ]; then
echo "No branch found, no patch generation"
fi
echo "Base commit SHA: $INITIAL_SHA"
# If we have a branch name, check if that branch exists and get its diff
if [ -n "$BRANCH_NAME" ]; then
@ -2448,47 +2446,26 @@ jobs:
# Check if the branch exists
if git show-ref --verify --quiet refs/heads/$BRANCH_NAME; then
echo "Branch $BRANCH_NAME exists, generating patch from branch changes"
# Generate patch from the base to the branch
git format-patch "$INITIAL_SHA".."$BRANCH_NAME" --stdout > /tmp/aw.patch || echo "Failed to generate patch from branch" > /tmp/aw.patch
echo "Patch file created from branch: $BRANCH_NAME"
# Check if origin/$BRANCH_NAME exists to use as base
if git show-ref --verify --quiet refs/remotes/origin/$BRANCH_NAME; then
echo "Using origin/$BRANCH_NAME as base for patch generation"
BASE_REF="origin/$BRANCH_NAME"
else
echo "origin/$BRANCH_NAME does not exist, using merge-base with default branch"
# Get the default branch name
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
echo "Default branch: $DEFAULT_BRANCH"
# Find merge base between default branch and current branch
BASE_REF=$(git merge-base origin/$DEFAULT_BRANCH $BRANCH_NAME)
echo "Using merge-base as base: $BASE_REF"
fi
# Generate patch from the determined base to the branch
git format-patch "$BASE_REF".."$BRANCH_NAME" --stdout > /tmp/aw.patch || echo "Failed to generate patch from branch" > /tmp/aw.patch
echo "Patch file created from branch: $BRANCH_NAME (base: $BASE_REF)"
else
echo "Branch $BRANCH_NAME does not exist, falling back to current HEAD"
BRANCH_NAME=""
fi
fi
# If no branch or branch doesn't exist, use the existing logic
if [ -z "$BRANCH_NAME" ]; then
echo "Using current HEAD for patch generation"
# Stage any unstaged files
git add -A || true
# Check if there are staged files to commit
if ! git diff --cached --quiet; then
echo "Staged files found, committing them..."
git commit -m "[agent] staged files" || true
echo "Staged files committed"
else
echo "No staged files to commit"
fi
# Check updated git status
echo "Updated git status after committing staged files:"
git status
# Show compact diff information between initial commit and HEAD (committed changes only)
echo '## Git diff' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
git diff --name-only "$INITIAL_SHA"..HEAD >> $GITHUB_STEP_SUMMARY || true
echo '```' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
# Check if there are any committed changes since the initial commit
if git diff --quiet "$INITIAL_SHA" HEAD; then
echo "No committed changes detected since initial commit"
echo "Skipping patch generation - no committed changes to create patch from"
else
echo "Committed changes detected, generating patch..."
# Generate patch from initial commit to HEAD (committed changes only)
git format-patch "$INITIAL_SHA"..HEAD --stdout > /tmp/aw.patch || echo "Failed to generate patch" > /tmp/aw.patch
echo "Patch file created at /tmp/aw.patch"
echo "Branch $BRANCH_NAME does not exist, no patch"
fi
fi

104
.github/workflows/pr-fix.lock.yml generated vendored
View file

@ -2,7 +2,7 @@
# To update this file, edit the corresponding .md file and run:
# gh aw compile
#
# Effective stop-time: 2025-09-19 15:41:02
# Effective stop-time: 2025-09-19 22:46:19
name: "PR Fix"
on:
@ -1083,7 +1083,7 @@ jobs:
WORKFLOW_NAME="PR Fix"
# Check stop-time limit
STOP_TIME="2025-09-19 15:41:02"
STOP_TIME="2025-09-19 22:46:19"
echo "Checking stop-time limit: $STOP_TIME"
# Convert stop time to epoch seconds
@ -2854,6 +2854,7 @@ jobs:
if: always()
env:
GITHUB_AW_SAFE_OUTPUTS: ${{ env.GITHUB_AW_SAFE_OUTPUTS }}
GITHUB_SHA: ${{ github.sha }}
run: |
# Check current git status
echo "Current git status:"
@ -2880,7 +2881,7 @@ jobs:
# Extract branch value using sed
BRANCH_NAME=$(echo "$line" | sed -n 's/.*"branch"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p')
if [ -n "$BRANCH_NAME" ]; then
echo "Extracted branch name from create-pull-request: $BRANCH_NAME"
echo "Extracted branch name from push-to-pr-branch: $BRANCH_NAME"
break
fi
fi
@ -2888,13 +2889,10 @@ jobs:
done < "$GITHUB_AW_SAFE_OUTPUTS"
fi
# Get the initial commit SHA from the base branch of the pull request
if [ "$GITHUB_EVENT_NAME" = "pull_request" ] || [ "$GITHUB_EVENT_NAME" = "pull_request_review_comment" ]; then
INITIAL_SHA="$GITHUB_BASE_REF"
else
INITIAL_SHA="$GITHUB_SHA"
# If no branch or branch doesn't exist, no patch
if [ -z "$BRANCH_NAME" ]; then
echo "No branch found, no patch generation"
fi
echo "Base commit SHA: $INITIAL_SHA"
# If we have a branch name, check if that branch exists and get its diff
if [ -n "$BRANCH_NAME" ]; then
@ -2902,47 +2900,26 @@ jobs:
# Check if the branch exists
if git show-ref --verify --quiet refs/heads/$BRANCH_NAME; then
echo "Branch $BRANCH_NAME exists, generating patch from branch changes"
# Generate patch from the base to the branch
git format-patch "$INITIAL_SHA".."$BRANCH_NAME" --stdout > /tmp/aw.patch || echo "Failed to generate patch from branch" > /tmp/aw.patch
echo "Patch file created from branch: $BRANCH_NAME"
# Check if origin/$BRANCH_NAME exists to use as base
if git show-ref --verify --quiet refs/remotes/origin/$BRANCH_NAME; then
echo "Using origin/$BRANCH_NAME as base for patch generation"
BASE_REF="origin/$BRANCH_NAME"
else
echo "origin/$BRANCH_NAME does not exist, using merge-base with default branch"
# Get the default branch name
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
echo "Default branch: $DEFAULT_BRANCH"
# Find merge base between default branch and current branch
BASE_REF=$(git merge-base origin/$DEFAULT_BRANCH $BRANCH_NAME)
echo "Using merge-base as base: $BASE_REF"
fi
# Generate patch from the determined base to the branch
git format-patch "$BASE_REF".."$BRANCH_NAME" --stdout > /tmp/aw.patch || echo "Failed to generate patch from branch" > /tmp/aw.patch
echo "Patch file created from branch: $BRANCH_NAME (base: $BASE_REF)"
else
echo "Branch $BRANCH_NAME does not exist, falling back to current HEAD"
BRANCH_NAME=""
fi
fi
# If no branch or branch doesn't exist, use the existing logic
if [ -z "$BRANCH_NAME" ]; then
echo "Using current HEAD for patch generation"
# Stage any unstaged files
git add -A || true
# Check if there are staged files to commit
if ! git diff --cached --quiet; then
echo "Staged files found, committing them..."
git commit -m "[agent] staged files" || true
echo "Staged files committed"
else
echo "No staged files to commit"
fi
# Check updated git status
echo "Updated git status after committing staged files:"
git status
# Show compact diff information between initial commit and HEAD (committed changes only)
echo '## Git diff' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
git diff --name-only "$INITIAL_SHA"..HEAD >> $GITHUB_STEP_SUMMARY || true
echo '```' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
# Check if there are any committed changes since the initial commit
if git diff --quiet "$INITIAL_SHA" HEAD; then
echo "No committed changes detected since initial commit"
echo "Skipping patch generation - no committed changes to create patch from"
else
echo "Committed changes detected, generating patch..."
# Generate patch from initial commit to HEAD (committed changes only)
git format-patch "$INITIAL_SHA"..HEAD --stdout > /tmp/aw.patch || echo "Failed to generate patch" > /tmp/aw.patch
echo "Patch file created at /tmp/aw.patch"
echo "Branch $BRANCH_NAME does not exist, no patch"
fi
fi
@ -3603,30 +3580,11 @@ jobs:
});
core.info(`Checked out existing branch from origin: ${branchName}`);
} catch (originError) {
// Branch doesn't exist on origin, check if it exists locally
try {
execSync(`git rev-parse --verify ${branchName}`, { stdio: "pipe" });
// Branch exists locally, check it out
execSync(`git checkout ${branchName}`, { stdio: "inherit" });
core.info(`Checked out existing local branch: ${branchName}`);
} catch (localError) {
// Branch doesn't exist locally or on origin, create it from default branch
core.info(
`Branch does not exist, creating new branch from default branch: ${branchName}`
);
// Get the default branch name
const defaultBranch = execSync(
"git remote show origin | grep 'HEAD branch' | cut -d' ' -f5",
{ encoding: "utf8" }
).trim();
core.info(`Default branch: ${defaultBranch}`);
// Ensure we have the latest default branch
execSync(`git checkout ${defaultBranch}`, { stdio: "inherit" });
execSync(`git pull origin ${defaultBranch}`, { stdio: "inherit" });
// Create new branch from default branch
execSync(`git checkout -b ${branchName}`, { stdio: "inherit" });
core.info(`Created new branch from default branch: ${branchName}`);
}
// Give an error if branch doesn't exist on origin
core.setFailed(
`Branch ${branchName} does not exist on origin, can't push to it: ${originError instanceof Error ? originError.message : String(originError)}`
);
return;
}
} catch (error) {
core.setFailed(