Skip to main content
The github.mjs module wraps @octokit/rest to search for agenda issues, create meeting issues, and update existing ones.

createGitHubClient(config)

Creates an authenticated Octokit REST client.
import * as github from './src/github.mjs';

const githubClient = github.createGitHubClient(config);

Parameters

config
AppConfig
required
Application configuration. Reads config.githubToken for the Authorization header and config.verbose to optionally attach console as the Octokit logger.

Returns

Octokit — a configured @octokit/rest client instance. When verbose is true, all API request and response details are logged via console.

getAgendaIssues(githubClient, config, meetingConfig)

Searches the GitHub organisation for all open issues that carry the meeting group’s agenda label, then groups them by repository.
const agendaIssues = await github.getAgendaIssues(
  githubClient,
  config,
  meetingConfig
);
// { 'nodejs/node': [...], 'nodejs/help': [...] }

Parameters

githubClient
Octokit
required
Authenticated Octokit client returned by createGitHubClient.
config
AppConfig
required
Application configuration. Reads config.meetingGroup to derive the default agenda label when AGENDA_TAG is not set in the template.
meetingConfig
MeetingConfig
required
Meeting configuration returned by readMeetingConfig. Reads properties.USER (GitHub org) and properties.AGENDA_TAG (label name).

Returns

Promise<Record<string, GitHubIssue[]>> — an object mapping repository paths (e.g., "nodejs/node") to arrays of matching issues. Uses paginate internally so all pages of results are returned, not just the first page.

sortIssuesByRepo(issues)

Groups a flat array of GitHub issues by their repository path.
const grouped = github.sortIssuesByRepo(issues);
// { 'nodejs/node': [...], 'nodejs/TSC': [...] }

Parameters

issues
GitHubIssue[]
required
Flat array of GitHub issue objects, each containing a repository_url field (e.g., "https://api.github.com/repos/nodejs/node").

Returns

Record<string, GitHubIssue[]> — issues grouped by the last two path segments of repository_url (owner/repo format).

createOrUpdateGitHubIssue(githubClient, config, meetingConfig, title, content)

The primary entry point for writing a meeting issue. Decides whether to create a new issue or update an existing one based on the --force flag and an exact title search.
const issue = await github.createOrUpdateGitHubIssue(
  githubClient,
  config,
  meetingConfig,
  meetingTitle,
  issueContent
);

Parameters

githubClient
Octokit
required
Authenticated Octokit client.
config
AppConfig
required
Application configuration. Reads config.force to decide whether to skip the duplicate check.
meetingConfig
MeetingConfig
required
Meeting configuration. Provides the target repository and org.
title
string
required
The meeting title to use as the issue title (e.g., "Node.js Technical Steering Committee (TSC) Meeting 2025-03-19").
content
string
required
The fully rendered issue body markdown.

Returns

Promise<GitHubIssue> — the created or existing issue object. Logic:
  1. If force is false: calls findGitHubIssueByTitle. If an issue is found and the body differs, calls updateGitHubIssue, then returns the existing issue object. If the body is identical, returns the existing issue without any write.
  2. If force is true or no existing issue is found: calls createGitHubIssue.

createGitHubIssue(githubClient, meetingConfig, title, content)

Creates a new GitHub issue in the repository configured in the meeting template.
const issue = await github.createGitHubIssue(
  githubClient,
  meetingConfig,
  title,
  content
);

Parameters

githubClient
Octokit
required
Authenticated Octokit client.
meetingConfig
MeetingConfig
required
Meeting configuration. Reads properties.USER (owner), properties.REPO (repo), and optionally properties.ISSUE_LABEL (applied as a label array).
title
string
required
Issue title.
content
string
required
Issue body markdown.

Returns

Promise<GitHubIssue> — the newly created issue data from the GitHub API (response.data).

updateGitHubIssue(githubClient, issueNumber, content, meetingConfig)

Updates the body of an existing GitHub issue.
await github.updateGitHubIssue(
  githubClient,
  existingIssue.number,
  newContent,
  meetingConfig
);

Parameters

githubClient
Octokit
required
Authenticated Octokit client.
issueNumber
number
required
The issue number to update.
content
string
required
The new issue body markdown.
meetingConfig
MeetingConfig
required
Meeting configuration. Reads properties.USER (owner) and properties.REPO (repo).

Returns

Promise<void> — resolves when the update API call completes.

findGitHubIssueByTitle(githubClient, title, meetingConfig)

Searches for an open GitHub issue with an exact title match using the GitHub search API.
const existing = await github.findGitHubIssueByTitle(
  githubClient,
  meetingTitle,
  meetingConfig
);

Parameters

githubClient
Octokit
required
Authenticated Octokit client.
title
string
required
The exact issue title to search for. The query uses in:title and is:open to narrow results to the configured repository.
meetingConfig
MeetingConfig
required
Meeting configuration. Reads properties.USER (owner) and properties.REPO (repo) to scope the search query to a single repository.

Returns

Promise<GitHubIssue | undefined> — the first matching issue, or undefined if no match is found. Only the first result is requested (per_page: 1).

Build docs developers (and LLMs) love