githubasana

package module
v1.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 10 Imported by: 0

README

GitHub Asana Request Review Action

CI

This GitHub Action integrates your GitHub pull requests with Asana. When a reviewer is assigned to a pull request, this action creates a corresponding code review subtask in an Asana task. The Asana task is specified in the pull request description.

Features

  • Automatic Subtask Creation: Creates an Asana subtask for code reviews when a reviewer is assigned on GitHub.
  • User Mapping: Maps GitHub users to Asana users.
  • Task Updates: Keeps the Asana task updated with the pull request status, including a link to the PR, changed file counts, and labels.
  • Business Day Calculation: Sets a due date for the review subtask, skipping weekends and holidays.

Workflow

  1. Create an Asana Task: Before creating a pull request, you should have an Asana task for the feature or bug fix.

  2. Create a Pull Request: When you create a pull request on GitHub, paste the URL of the Asana task into the pull request description.

  3. Assign a Reviewer: Assign one or more reviewers to the pull request.

  4. Subtask Created in Asana: The action will automatically create a subtask in the Asana task for each reviewer. The subtask will be assigned to the corresponding Asana user and will contain details about the pull request.

Usage

To use this action in your workflow, you need to add a step to your workflow file (e.g., .github/workflows/main.yml).

Inputs
  • config_path (optional): The path to the configuration file. Defaults to .github/github-asana-request-review.yml.
Secrets
  • ASANA_TOKEN: Your Asana Personal Access Token.
  • GITHUB_TOKEN: The default GitHub token provided by GitHub Actions.
Example Workflow
name: Asana Integration

on:
  pull_request:
    types:
      - opened
      - edited
      - synchronize
      - review_requested
      - review_request_removed
      - labeled
      - unlabeled
  pull_request_review:
    types:
      - submitted

jobs:
  asana-integration:
    runs-on: ubuntu-latest
    steps:
      - name: GitHub Asana Request Review Action
        uses: keitap/github-asana-request-review-action@v1
        with:
          config_path: '.github/github-asana-request-review.yml'
        env:
          ASANA_TOKEN: ${{ secrets.ASANA_TOKEN }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Configuration File

The action is configured via a YAML file. By default, it looks for .github/github-asana-request-review.yml.

Here is an example of the configuration file:

# Number of business days until the review is due.
due_date: 1

# A list of holidays to exclude from due date calculations.
# Format is YYYY-MM-DD.
holidays:
  "2024-01-01": true
  "2024-12-25": true

# Mapping of GitHub usernames to Asana User GIDs.
# You can get the GID of an Asana user from the Asana API or by looking at the URL in Asana.
accounts:
  github-username1: "1234567890123456"
  github-username2: "2345678901234567"
Configuration Options
  • due_date (integer): The number of business days to add to the current date to set the due date for the review subtask. Defaults to 1.
  • holidays (map): A map of dates in YYYY-MM-DD format to true. These dates will be excluded when calculating the due date.
  • accounts (map): A map where the keys are GitHub usernames and the values are the corresponding Asana User GIDs. This is used to assign the subtask to the correct user in Asana.

Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue. If you want to contribute code, please open a pull request.

For more details on the project architecture and development, please see the DeepWiki page.

To build the action locally, you will need Go installed. You can run the tests with make test.

License

This project is licensed under the MIT License.


This README was generated by Jules, a generative AI bot from Google.

Documentation

Overview

Package githubasana provides GitHub and Asana pull request task integration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCodeReviewSubtask

func AddCodeReviewSubtask(client *asana.Client, taskID string, prID int, requester *Account, reviewer *Account, dueDate asana.Date, pr *github.PullRequestEvent) (*asana.Task, error)

func AddCodeReviewSubtaskComment added in v1.1.0

func AddCodeReviewSubtaskComment(client *asana.Client, subtask *asana.Task, requester *Account, reviewer *Account, pr *github.PullRequestReviewEvent, commentCount int) (*asana.Story, error)

func AddPullRequestCommentToTask

func AddPullRequestCommentToTask(client *asana.Client, taskID string, requester *Account, pr *github.PullRequestEvent) (*asana.Story, error)

func FindSubtaskByName

func FindSubtaskByName(client *asana.Client, taskID string, findString string) (*asana.Task, error)

FindSubtaskByName finds a subtask which contains specified string.

func FindTaskComment

func FindTaskComment(client *asana.Client, taskID string, findString string) (*asana.Story, error)

FindTaskComment finds a story which contains specified string.

func NextBusinessDay added in v1.1.0

func NextBusinessDay(n int, base time.Time, holidays map[string]bool) time.Time

NextBusinessDay returns next n business day. If n is zero, it returns most recent business day including `base` day.

func UpdateCodeReviewSubtask added in v1.1.0

func UpdateCodeReviewSubtask(client *asana.Client, subtask *asana.Task, requester *Account, pr *github.PullRequestEvent) error

func UpdateTaskComment

func UpdateTaskComment(client *asana.Client, storyID string, requester *Account, pr *github.PullRequestEvent) (*asana.Story, error)

Types

type Account added in v1.0.2

type Account struct {
	Name         string
	AsanaUserGID string
	GitHubLogin  string
}

func NewAccount added in v1.0.2

func NewAccount(client *asana.Client, userGID string, githubLogin string) (*Account, error)

func NewNoAsanaAccount added in v1.0.2

func NewNoAsanaAccount(githubLogin string) *Account
func (u *Account) GetUserPermalink() string

func (*Account) String added in v1.0.2

func (u *Account) String() string

type AsanaGID

type AsanaGID = string

type Config

type Config struct {
	DueDate  int                      `yaml:"due_date"`
	Holidays map[string]bool          `yaml:"holidays"`
	Accounts map[GithubLogin]AsanaGID `yaml:"accounts"`
}

func LoadConfig

func LoadConfig(data []byte) (*Config, error)

type GithubLogin

type GithubLogin = string

type Handler added in v1.0.2

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler added in v1.0.2

func NewHandler(conf *Config, asanaClient *asana.Client, githubClient *github.Client) *Handler

func (*Handler) Handle added in v1.0.2

func (h *Handler) Handle(eventName string, eventPayload []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL