Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ci: add auto-generated summary and GitHub issue comment workflows to triage.yaml#19925

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

Merged
johnstcn merged 11 commits intomainfromcj/traiage/gh-issue-comment
Sep 24, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 38 additions & 22 deletions.github/workflows/traiage.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,18 +4,18 @@ on:
workflow_dispatch:
inputs:
issue_url:
description:'GitHub Issue URL to process'
description:"GitHub Issue URL to process"
required: true
type: string
template_name:
description:'Coder template to use for workspace'
description:"Coder template to use for workspace"
required: true
default:'traiage'
default:"traiage"
type: string
prefix:
description:'Prefix for workspace name'
description:"Prefix for workspace name"
required: false
default:'traiage'
default:"traiage"
type: string

jobs:
Expand DownExpand Up@@ -89,7 +89,7 @@ jobs:
ISSUE_URL: ${{ inputs.issue_url }}
GITHUB_TOKEN: ${{ github.token }}
run: |
PROMPT_FILE=/tmp/prompt.txt
PROMPT_FILE=$(mktemp)
trap 'rm -f "${PROMPT_FILE}"' EXIT

# Fetch issue description using `gh` CLI
Expand All@@ -108,7 +108,7 @@ jobs:
echo "WORKSPACE_NAME: ${WORKSPACE_NAME}"
# This command will run the prompt inside the workspace
# and exit once the agent has completed the task.
PROMPT=$(cat$PROMPT_FILE) ./scripts/traiage.sh prompt
PROMPT=$(cat"${PROMPT_FILE}") ./scripts/traiage.sh prompt

- name: Create and upload archive
id: create-archive
Expand All@@ -119,27 +119,43 @@ jobs:
./scripts/traiage.sh archive
echo "archive_url=${BUCKET_PREFIX%%/}/$WORKSPACE_NAME.tar.gz" >> "${GITHUB_OUTPUT}"

- name: Report results
- name: Generate a summary of the changes and post a comment on GitHub.
id: generate-summary
env:
ISSUE_URL: ${{ inputs.issue_url }}
CONTEXT_KEY: ${{ steps.extract-context.outputs.context_key }}
WORKSPACE_NAME: ${{ steps.create-workspace.outputs.workspace_name }}
ARCHIVE_URL: ${{ steps.create-archive.outputs.archive_url }}
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 }}
WORKSPACE_NAME: ${{ steps.create-workspace.outputs.workspace_name }}
run: |
SUMMARY_FILE=$(mktemp)
trap 'rm -f "${SUMMARY_FILE}"' EXIT
AUTO_SUMMARY=$(./scripts/traiage.sh summary)
{
echo "## TrAIage Results";
echo "- **Issue URL:** ${ISSUE_URL}";
echo "- **Context Key:** ${CONTEXT_KEY}";
echo "- **Workspace:** ${WORKSPACE_NAME}";
echo "- **Archive URL:** ${ARCHIVE_URL}";

echo "To fetch the output to your own workspace:";
echo '';
echo '```bash';
echo "BUCKET_PREFIX=${BUCKET_PREFIX} WORKSPACE_NAME=${WORKSPACE_NAME} ./scripts/traiage.sh resume";
echo "## TrAIage Results"
echo "- **Issue URL:** ${ISSUE_URL}"
echo "- **Context Key:** ${CONTEXT_KEY}"
echo "- **Workspace:** ${WORKSPACE_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} WORKSPACE_NAME=${WORKSPACE_NAME} ./scripts/traiage.sh resume"
echo '```'
} >> "${GITHUB_STEP_SUMMARY}"
echo
} >> "${SUMMARY_FILE}"

if [[ "${ISSUE_URL}" == "https://github.com/${GITHUB_REPOSITORY}"* ]]; then
gh issue comment "${ISSUE_URL}" --body-file "${SUMMARY_FILE}" --create-if-none --edit-last
else
echo "Skipping comment on other repo."
fi
cat "${SUMMARY_FILE}" >> "${GITHUB_STEP_SUMMARY}"

- name: Cleanup workspace
if: steps.create-workspace.outputs.workspace_name != '' && steps.create-archive.outputs.archive_url != ''
Expand Down
46 changes: 45 additions & 1 deletionscripts/traiage.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,6 +20,18 @@ usage() {

create() {
requiredenvs CODER_URL CODER_SESSION_TOKEN WORKSPACE_NAME TEMPLATE_NAME TEMPLATE_PARAMETERS
# Check if a workspace already exists
exists=$("${CODER_BIN}" \
--url "${CODER_URL}" \
--token "${CODER_SESSION_TOKEN}" \
list \
--search "owner:me" \
--output json |
jq -r --arg name "${WORKSPACE_NAME}" 'any(.[]; select(.name == $name))')
if [[ "${exists}" == "true" ]]; then
echo "Workspace ${WORKSPACE_NAME} already exists."
exit 0
fi
"${CODER_BIN}" \
--url "${CODER_URL}" \
--token "${CODER_SESSION_TOKEN}" \
Expand DownExpand Up@@ -54,7 +66,8 @@ ssh_config() {
--url "${CODER_URL}" \
--token "${CODER_SESSION_TOKEN}" \
--ssh-config-file="${OPENSSH_CONFIG_FILE}" \
--yes
--yes \
>/dev/null 2>&1
export OPENSSH_CONFIG_FILE
}

Expand DownExpand Up@@ -169,6 +182,34 @@ archive() {
exit 0
}

summary() {
requiredenvs CODER_URL CODER_SESSION_TOKEN WORKSPACE_NAME
ssh_config

# We want the heredoc to be expanded locally and not remotely.
# shellcheck disable=SC2087
ssh \
-F "${OPENSSH_CONFIG_FILE}" \
"${WORKSPACE_NAME}.coder" \
-- \
bash <<-EOF
#!/usr/bin/env bash
set -eu
summary=\$(echo -n 'You are a CLI utility that generates a human-readable Markdown summary for the currently staged AND unstaged changes. Print ONLY the summary and nothing else.' | \${HOME}/.local/bin/claude --print)
Copy link
Preview

CopilotAISep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

[nitpick] The command line for generating the summary is excessively long and hard to read. Consider breaking this into multiple lines or storing the prompt in a variable for better readability and maintainability.

Suggested change
summary=\$(echo -n'You are a CLI utility that generates a human-readable Markdown summary for the currently staged AND unstaged changes. Print ONLY the summary and nothing else.'|\${HOME}/.local/bin/claude --print)
SUMMARY_PROMPT='You are a CLI utility that generates a human-readable Markdown summary for the currently staged AND unstaged changes. Print ONLY the summary and nothing else.'
summary=\$(echo -n"\${SUMMARY_PROMPT}"|\${HOME}/.local/bin/claude --print)

Copilot uses AI. Check for mistakes.

if [[ -z "\${summary}" ]]; then
echo "Generating a summary failed."
echo "Here is a short overview of the changes:"
echo
echo ""
echo "\$(git diff --stat)"
echo ""
exit 0
fi
echo "\${summary}"
exit 0
EOF
}

commit_push() {
requiredenvs CODER_URL CODER_SESSION_TOKEN WORKSPACE_NAME
ssh_config
Expand DownExpand Up@@ -265,6 +306,9 @@ main() {
resume)
resume
;;
summary)
summary
;;
*)
echo "Unknown option: $1"
usage
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp