How the GitHub-Asana Request Review Action Handles Holidays in Due Date Calculations

The action calculates due dates by advancing a configurable number of business days from the current date, using a YAML-defined holiday map where dates follow the YYYY-MM-DD format and boolean values indicate whether to treat the day as a non-working holiday (true) or explicitly as a working day (false) to override weekends.

The keitap/github-asana-request-review-action automates Asana task creation from GitHub pull requests, including due date calculations that respect holidays and weekends. When a pull request triggers the workflow, the action computes the review due date by adding business days while skipping dates defined in the configuration. Understanding how this open-source Go application handles holidays in due date calculations requires examining the business-day logic implemented in date.go and the configuration structure defined in config.go.

Holiday Configuration Format

The action reads holiday definitions from the repository's YAML configuration file. The holidays field is parsed as a map[string]bool where each key represents a specific calendar date.

In [config.go](https://github.com/keitap/github-asana-request-review-action/blob/main/config.go#L11-L14), the Config struct defines the Holidays field:

type Config struct {
    DueDate   int               `yaml:"due_date"`
    Holidays  map[string]bool   `yaml:"holidays"`
    // ... other fields
}

The date format follows Go's reference layout 2006-01-02, which corresponds to ISO 8601 format (YYYY-MM-DD). This format is used consistently when checking dates against the holiday map.

Configuration Examples

Consider the following example from the project's testdata:

due_date: 3
holidays:
  2021-05-01: false
  2021-05-03: true

In this configuration:

  • 2021-05-01 (Saturday) is explicitly set to false, treating it as a working day despite being a weekend
  • 2021-05-03 (Monday) is marked as true, treating it as a holiday to be skipped

Business Day Calculation Implementation

The core date arithmetic resides in [date.go](https://github.com/keitap/github-asana-request-review-action/blob/main/date.go). The NextBusinessDay function accepts the base time, the number of days to add, and the holidays map.

The isHoliday Helper Function

The isHoliday helper determines if a given date should be skipped according to the source code in [date.go](https://github.com/keitap/github-asana-request-review-action/blob/main/date.go#L36-L43):

func isHoliday(t time.Time, holidays map[string]bool) bool {
    dateKey := t.Format("2006-01-02")
    if v, ok := holidays[dateKey]; ok {
        return v
    }
    // If not in map, check for weekends
    return t.Weekday() == time.Saturday || t.Weekday() == time.Sunday
}

This logic implements a precedence system:

  • Explicit holidays: If the date exists in the map with value true, it returns true (treated as a holiday)
  • Explicit working days: If the date exists with value false, it returns false, treating the day as a working day even if it falls on a weekend
  • Default weekend rule: Dates not present in the map are treated as holidays only if they are Saturday or Sunday

NextBusinessDay Logic

The NextBusinessDay function implements the counting logic by iterating forward from the base date. It first advances past any holidays or weekends at the starting position, then counts only days where isHoliday returns false until reaching the configured offset.

Integration with Asana Task Creation

Once calculated, the due date is applied to the Asana sub-task. In [handler.go](https://github.com/keitap/github-asana-request-review-action/blob/main/handler.go#L155), the action invokes the business day calculator before creating the task:

dueDate := NextBusinessDay(config.DueDate, time.Now(), config.Holidays)
// ... converts to Asana date format and sets on task

This ensures that review due dates account for team availability based on the configured holiday calendar.

Summary

Frequently Asked Questions

What date format should I use for holidays in the configuration file?

Use the ISO 8601 date format YYYY-MM-DD (for example, 2024-12-25). The action formats comparison dates using Go's time.Format with the layout string "2006-01-02", so your YAML keys must match this exact format to be recognized by the isHoliday function.

How do I make the action treat a weekend day as a working day?

Add the specific Saturday or Sunday date to your configuration with a value of false. For example, setting 2024-01-06: false tells the action to treat that Saturday as a business day, overriding the default weekend detection in [date.go](https://github.com/keitap/github-asana-request-review-action/blob/main/date.go#L36-L43).

What happens if I do not configure any holidays?

If the holidays map is empty or omitted from the YAML file, the action treats only Saturdays and Sundays as non-working days. The isHoliday function checks the map first; when a date is absent, it falls back to checking if the weekday is Saturday or Sunday.

Where is the due date calculation performed in the codebase?

The calculation is performed in [date.go](https://github.com/keitap/github-asana-request-review-action/blob/main/date.go) by the NextBusinessDay function, which uses the isHoliday helper to skip configured holidays and weekends. The resulting date is then applied to the Asana task in [handler.go](https://github.com/keitap/github-asana-request-review-action/blob/main/handler.go#L155).

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →