mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
ci: assign tasks to triggering username in ai triage workflow (#20022)
Note: this requires owner-level perms on the token. This can be removed once it becomes possible to search org members by GitHub ID without owner-level perms. --------- Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
This commit is contained in:
co-authored by
Mathias Fredriksson
parent
ec417ded24
commit
edd9746443
+4
-3
@@ -19,18 +19,18 @@ usage() {
|
||||
}
|
||||
|
||||
create() {
|
||||
requiredenvs CODER_URL CODER_SESSION_TOKEN TASK_NAME TEMPLATE_NAME TEMPLATE_PRESET PROMPT
|
||||
requiredenvs CODER_URL CODER_SESSION_TOKEN CODER_USERNAME TASK_NAME TEMPLATE_NAME TEMPLATE_PRESET PROMPT
|
||||
# Check if a task already exists
|
||||
set +e
|
||||
task_json=$("${CODER_BIN}" \
|
||||
--url "${CODER_URL}" \
|
||||
--token "${CODER_SESSION_TOKEN}" \
|
||||
exp tasks status "${TASK_NAME}" \
|
||||
exp tasks status "${CODER_USERNAME}/${TASK_NAME}" \
|
||||
--output json)
|
||||
set -e
|
||||
|
||||
if [[ "${TASK_NAME}" == $(jq -r '.name' <<<"${task_json}") ]]; then
|
||||
echo "Task \"${TASK_NAME}\" already exists. Sending prompt to existing task."
|
||||
echo "Task \"${CODER_USERNAME}/${TASK_NAME}\" already exists. Sending prompt to existing task."
|
||||
prompt
|
||||
exit 0
|
||||
fi
|
||||
@@ -43,6 +43,7 @@ create() {
|
||||
--template "${TEMPLATE_NAME}" \
|
||||
--preset "${TEMPLATE_PRESET}" \
|
||||
--org coder \
|
||||
--owner "${CODER_USERNAME}" \
|
||||
--stdin <<<"${PROMPT}"
|
||||
exit 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user