- Notifications
You must be signed in to change notification settings - Fork1k
ci: create tasks instead of workspaces in ai triage workflow#19940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
bdb6838
864e202
4fde2a7
651c09c
27b645a
06178c0
e774347
936d3a7
c8da6a1
5b948b3
afe12c6
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -12,6 +12,11 @@ on: | ||
required: true | ||
default: "traiage" | ||
type: string | ||
template_preset: | ||
description: "Template preset to use" | ||
required: true | ||
default: "Default" | ||
type: string | ||
prefix: | ||
description: "Prefix for workspace name" | ||
required: false | ||
@@ -68,67 +73,62 @@ jobs: | ||
coder whoami | ||
echo "$HOME/.local/bin" >> "${GITHUB_PATH}" | ||
# TODO(Cian): this is a good use-case for 'recipes' | ||
- name: Create Coder task | ||
id: create-task | ||
env: | ||
CONTEXT_KEY: ${{ steps.extract-context.outputs.context_key }} | ||
GITHUB_TOKEN: ${{ github.token }} | ||
ISSUE_URL: ${{ inputs.issue_url }} | ||
PREFIX: ${{ inputs.prefix }} | ||
RUN_ID: ${{ github.run_id }} | ||
TEMPLATE_PARAMETERS: ${{ secrets.TRAIAGE_TEMPLATE_PARAMETERS }} | ||
TEMPLATE_PRESET: ${{ inputs.template_preset }} | ||
# TODO: replace with coder exp task command | ||
APP_SLUG: ccw | ||
run: | | ||
# Fetch issue description using `gh` CLI | ||
issue_description=$(gh issue view "${ISSUE_URL}") | ||
# Write a prompt to PROMPT_FILE | ||
PROMPT=$(cat <<EOF | ||
Analyze the below GitHub issue description, understand the root cause, and make appropriate changes to resolve the issue. | ||
ISSUE URL: ${ISSUE_URL} | ||
ISSUE DESCRIPTION BELOW: | ||
${issue_description} | ||
EOF | ||
) | ||
export PROMPT | ||
export TASK_NAME="${PREFIX}-${CONTEXT_KEY}-${RUN_ID}" | ||
echo "Creating task: $TASK_NAME" | ||
./scripts/traiage.sh create | ||
./scripts/traiage.sh wait | ||
echo "TASK_NAME=${TASK_NAME}" >> "${GITHUB_OUTPUT}" | ||
echo "TASK_NAME=${TASK_NAME}" >> "${GITHUB_ENV}" | ||
johnstcn marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
- name: Create and upload archive | ||
id: create-archive | ||
env: | ||
BUCKET_PREFIX: "gs://coder-traiage-outputs/traiage" | ||
run: | | ||
echo "Creating archive for workspace: $TASK_NAME" | ||
./scripts/traiage.sh archive | ||
echo "archive_url=${BUCKET_PREFIX%%/}/$TASK_NAME.tar.gz" >> "${GITHUB_OUTPUT}" | ||
- name: Generate a summary of the changes and post a comment on GitHub. | ||
id: generate-summary | ||
env: | ||
ARCHIVE_URL: ${{ steps.create-archive.outputs.archive_url }} | ||
APP_SLUG: ccw | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I know we have the required envs check, but I'm wondering if it'd be better to define these Mayhaps doing something like this early on:
(There's probably a better way to do it.) Or write a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Long-term I want to remove the need for this (e.g by using | ||
BUCKET_PREFIX: "gs://coder-traiage-outputs/traiage" | ||
CONTEXT_KEY: ${{ steps.extract-context.outputs.context_key }} | ||
GITHUB_TOKEN: ${{ github.token }} | ||
GITHUB_REPOSITORY: ${{ github.repository }} | ||
ISSUE_URL: ${{ inputs.issue_url }} | ||
TASK_NAME: ${{ steps.create-task.outputs.TASK_NAME }} | ||
run: | | ||
SUMMARY_FILE=$(mktemp) | ||
trap 'rm -f "${SUMMARY_FILE}"' EXIT | ||
@@ -137,15 +137,15 @@ jobs: | ||
echo "## TrAIage Results" | ||
echo "- **Issue URL:** ${ISSUE_URL}" | ||
echo "- **Context Key:** ${CONTEXT_KEY}" | ||
echo "- **Workspace:** ${TASK_NAME}" | ||
echo "- **Archive URL:** ${ARCHIVE_URL}" | ||
echo | ||
echo "${AUTO_SUMMARY}" | ||
echo | ||
echo "To fetch the output to your own workspace:" | ||
echo | ||
echo '```bash' | ||
echo "BUCKET_PREFIX=${BUCKET_PREFIX}TASK_NAME=${TASK_NAME} ./scripts/traiage.sh resume" | ||
echo '```' | ||
echo | ||
} >> "${SUMMARY_FILE}" | ||
@@ -157,8 +157,8 @@ jobs: | ||
fi | ||
cat "${SUMMARY_FILE}" >> "${GITHUB_STEP_SUMMARY}" | ||
- name: Cleanuptask | ||
if: steps.create-task.outputs.TASK_NAME != '' && steps.create-archive.outputs.archive_url != '' | ||
run: | | ||
echo "Cleaning uptask: $TASK_NAME" | ||
./scripts/traiage.sh delete || true |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.