Skip to content

coder/create-task-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Coder Task GitHub Action

This GitHub action starts a Coder Task and optionally posts a comment on a GitHub issue. It's designed to be used as part of a wider workflow.

Overview

  • When creating a Coder task, you must specify the Github user ID as an input.
  • The action then queries the Coder deployment to find the Coder user associated with the given Github user ID.
    • Note that this requires the Coder deployment to be configured with GitHub OAuth and for the Coder user to have linked their GitHub account.
    • If no corresponding Coder user is found, the action will fail.
  • The action will then create a Coder Task for the user with the given template and prompt.
  • Once the task has been created successfully, the action will post a comment on the GitHub issue with the task URL.

Requirements

  • A running Coder deployment (v2.28 or higher) accessible to the GitHub Actions runner.
  • A Tasks-capable Coder template
  • A Coder session token with the required permissions to:
    • Read all users in the given organization
    • Create tasks for any user in the given organization

Example Usage

The below example will start a Coder task when the coder label is applied to an issue.

name: Start Coder Task

on:
  issues:
    types:
      - labeled

permissions:
  issues: write

jobs:
  coder-create-task:
    runs-on: ubuntu-latest
    if: github.event.label.name == 'coder'
    steps:
      - name: Coder Create Task
        uses: coder/create-task-action@v0
        with:
          coder-url: ${{ secrets.CODER_URL }}
          coder-token: ${{ secrets.CODER_TOKEN }}
          coder-organization: "default"
          coder-template-name: "my-template"
          coder-task-name-prefix: "gh-task"
          coder-task-prompt: "Use the gh CLI to read ${{ github.event.issue.html_url }}, write an appropriate plan for solving the issue to PLAN.md, and then wait for feedback."
          github-user-id: ${{ github.event.sender.id }}
          github-issue-url: ${{ github.event.issue.html_url }}
          github-token: ${{ github.token }}
          comment-on-issue: true

Inputs

Name Description Required Default
coder-task-prompt Prompt/instructions to send to the task true -
coder-token Coder session token for authentication true -
coder-url Coder deployment URL true -
coder-template-name Coder template to use for workspace true -
github-issue-url GitHub issue URL to link this task to true -
github-token GitHub token for API operations true -
github-user-id GitHub user ID to create task for true -
coder-organization Coder organization name false "default"
coder-task-name-prefix Prefix for task name false "gh"
coder-template-preset Template preset to use (optional) false -
comment-on-issue Whether to comment on the GitHub issue false true

Outputs

Name Description
coder-username The Coder username resolved from GitHub user
task-name The task name
task-url The URL to view the task in Coder
task-created Whether the task was newly created (true) or already existed (false)

About

No description, website, or topics provided.

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •