# How Changed File Counts (Additions and Deletions) Are Displayed in Asana by the GitHub Action

> See how the GitHub Action displays changed file counts with additions and deletions in Asana comments. Understand the `<b>12</b> changed files (<b>+45 -7</b>)` format.

- Repository: [Keita Kitamura/github-asana-request-review-action](https://github.com/keitap/github-asana-request-review-action)
- Tags: how-to-guide
- Published: 2026-03-05

---

**The action formats changed file statistics as bold HTML—`<b>12</b> changed files (<b>+45 -7</b>)`—when posting comments to Asana tasks and sub-task descriptions.**

The `keitap/github-asana-request-review-action` repository synchronizes GitHub pull request events with Asana project management workflows. When processing a PR webhook, the action extracts **changed file counts**, **additions**, and **deletions** from the GitHub API and renders them in a specific HTML pattern that Asana displays as bold, scannable metrics.

## HTML Format Pattern in Asana Comments

The action constructs an HTML snippet that Asana renders as bold statistics. The pattern follows this exact structure:

```html
<b>{changedFiles}</b> changed files (<b>+{additions} -{deletions}</b>)

```

This formatting appears in two contexts within [`asana.go`](https://github.com/keitap/github-asana-request-review-action/blob/main/asana.go): comments attached to the main Asana task and descriptions for review-request sub-tasks.

## Implementation in [`asana.go`](https://github.com/keitap/github-asana-request-review-action/blob/main/asana.go)

The formatting logic resides in [`asana.go`](https://github.com/keitap/github-asana-request-review-action/blob/main/asana.go) (lines 84–108), where two generator functions build the HTML content using Go's `fmt.Sprintf`.

### Main Task Comments: `createPullRequestCommentText`

When posting a general PR update to the parent Asana task, the `createPullRequestCommentText` function (lines 84–95) embeds the statistics using:

```go
func createPullRequestCommentText(requester *Account, pr *github.PullRequestEvent) string {
    return fmt.Sprintf(`<body>📋 <code>[<b>%s</b>] <a href="%s">Pull request #%d: %s</a> by %s

<b>%d</b> changed files (<b>+%d -%d</b>)
%s

%s
</code></body>`,
        pr.PullRequest.GetState(),
        pr.PullRequest.GetHTMLURL(), pr.PullRequest.GetNumber(), pr.PullRequest.GetTitle(), requester.GetUserPermalink(),
        pr.PullRequest.GetChangedFiles(),
        pr.PullRequest.GetAdditions(),
        pr.PullRequest.GetDeletions(),
        getLabelsText(pr),
        signature,
    )
}

```

Line 87 specifically injects the bold-formatted counts:

```go
<b>%d</b> changed files (<b>+%d -%d</b>)

```

### Review Request Sub-tasks: `createReviewRequestDescText`

For individual reviewer assignments, the `createReviewRequestDescText` function (lines 100–108) generates sub-task descriptions using identical formatting:

```go
func createReviewRequestDescText(requester *Account, pr *github.PullRequestEvent) string {
    return fmt.Sprintf(`<body><a href="%s">#%d: %s</a> by %s

<b>%d</b> changed files (<b>+%d -%d</b>)
%s

Could you please review a pull request ❤️
</body>`,
        pr.PullRequest.GetHTMLURL(), pr.PullRequest.GetNumber(), pr.PullRequest.GetTitle(), requester.GetUserPermalink(),
        pr.PullRequest.GetChangedFiles(),
        pr.PullRequest.GetAdditions(),
        pr.PullRequest.GetDeletions(),
        getLabelsText(pr),
    )
}

```

Line 102 repeats the same HTML pattern to ensure consistency across both comment types.

## Data Source from GitHub API

The numeric values are retrieved directly from the GitHub Pull Request event payload using three getter methods:

- **`pr.PullRequest.GetChangedFiles()`** — Returns the total number of files modified
- **`pr.PullRequest.GetAdditions()`** — Returns the count of lines added (`+`)
- **`pr.PullRequest.GetDeletions()`** — Returns the count of lines deleted (`-`)

These methods provide the raw integers that populate the `%d` placeholders in the HTML format strings.

## Summary

- **Bold HTML formatting**: The action wraps changed file counts in `<b>` tags to ensure they render prominently in Asana's rich text editor.
- **Dual context usage**: The pattern appears in both `createPullRequestCommentText` (main task comments) and `createReviewRequestDescText` (reviewer sub-tasks) within [`asana.go`](https://github.com/keitap/github-asana-request-review-action/blob/main/asana.go).
- **Direct API mapping**: Values come from `GetChangedFiles()`, `GetAdditions()`, and `GetDeletions()` methods on the GitHub pull request object.
- **Consistent structure**: Both functions use identical Go `fmt.Sprintf` templates at lines 87 and 102 to maintain uniform display across all Asana updates.

## Frequently Asked Questions

### What HTML format does the action use for changed file counts?

The action uses the pattern `<b>%d</b> changed files (<b>+%d -%d</b>)`, where the bold tags ensure Asana renders the file count, additions, and deletions as prominent statistics rather than plain text.

### Which GitHub API methods provide the file statistics?

According to the source code in [`asana.go`](https://github.com/keitap/github-asana-request-review-action/blob/main/asana.go), the action calls three methods on the pull request object: `GetChangedFiles()` for the total file count, `GetAdditions()` for lines added, and `GetDeletions()` for lines removed.

### Where in the codebase is this formatting implemented?

The formatting logic is implemented in [`/asana.go`](https://github.com/keitap/github-asana-request-review-action/blob/main//asana.go) within the `createPullRequestCommentText` function (lines 84–95) and the `createReviewRequestDescText` function (lines 100–108).

### Does this formatting appear in both comments and sub-task descriptions?

Yes. The bold HTML pattern appears in both contexts: when the action posts a comment to the main Asana task and when it creates a sub-task description requesting a specific reviewer. Both use identical formatting to display **changed files** (**+additions -deletions**) metrics.