Skip to content

chore: inline find-comment/create-or-update-comment#413

Open
kevmoo wants to merge 7 commits into
mainfrom
inline_coment_bits
Open

chore: inline find-comment/create-or-update-comment#413
kevmoo wants to merge 7 commits into
mainfrom
inline_coment_bits

Conversation

@kevmoo
Copy link
Copy Markdown
Member

@kevmoo kevmoo commented Apr 16, 2026

Some Google repos don't like actions from "outside the enterprise"

Other fixes:

  • Updated the logic to pull in firehose during PRs to THIS repo, so they can be validated together.
    • I think we had issues previously before this was NOT done so we landed firehose fixes blind
    • Sadly, it's pretty verbose.
  • Improved the robustness of the github.dart file
    • General wise handling of null bits to give helpful errors

Partially addresses #395

Some Google repos don't like actions from "outside the enterprise"
@kevmoo kevmoo requested a review from mosuem as a code owner April 16, 2026 03:25
@github-actions github-actions Bot added package:firehose type-infra A repository infrastructure change or enhancement labels Apr 16, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new comment CLI tool in pkgs/firehose/bin/comment.dart for finding, creating, and updating GitHub comments. It also extends the GithubApi and LocalGithubApi classes with createComment and updateComment methods. The review feedback identifies improvement opportunities regarding resource management, specifically closing the GithubApi instance to prevent leaks, and enhancing input validation for the issue number in the create-or-update command.

Comment thread pkgs/firehose/bin/comment.dart
Comment thread pkgs/firehose/bin/comment.dart Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 16, 2026

PR Health

License Headers ✔️
// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

This check can be disabled by tagging the PR with skip-license-check.

Unused Dependencies ✔️
Package Status
firehose ✔️ All dependencies utilized correctly.

For details on how to fix these, see dependency_validator.

This check can be disabled by tagging the PR with skip-unused-dependencies-check.

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

Coverage ⚠️
File Coverage
pkgs/firehose/lib/src/github.dart 💔 55 % ⬇️ 7 %
pkgs/firehose/lib/src/local_github_api.dart 💔 42 % ⬇️ 13 %

This check for test coverage is informational (issues shown here will not fail the PR).

This check can be disabled by tagging the PR with skip-coverage-check.

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
firehose Non-Breaking 0.13.0 0.13.2-wip 0.13.2-wip ✔️

This check can be disabled by tagging the PR with skip-breaking-check.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbol Leaking sources

This check can be disabled by tagging the PR with skip-leaking-check.

@kevmoo
Copy link
Copy Markdown
Member Author

kevmoo commented Apr 16, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new comment executable to the firehose package, enabling the management of GitHub comments as a first-class command. The changes include a new CLI tool in bin/comment.dart, updates to the GithubApi to support creating and updating comments, and registration of the new executable in pubspec.yaml. The review feedback suggests enhancing the tool's robustness by implementing better error handling for API failures, validating that comment bodies are not empty, and avoiding potential null pointer exceptions when accessing repository information.

Comment thread pkgs/firehose/bin/comment.dart
Comment thread pkgs/firehose/bin/comment.dart Outdated
Comment thread pkgs/firehose/lib/src/github.dart
Comment thread .github/workflows/canary.yaml
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:io';
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~150 lines for bits we don't need to depend on seems worth it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do like using dart scripts


String? get githubAuthToken => _env['GITHUB_TOKEN'];

late final RepositorySlug? _resolvedSlug = _repoSlug ??
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes error cases a LOT cleaner to understand

@kevmoo
Copy link
Copy Markdown
Member Author

kevmoo commented Apr 16, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new comment executable to the firehose package, allowing for the discovery, creation, and updating of GitHub comments directly. It also refactors GithubApi to improve repository slug handling and adds methods for comment management. Critical feedback was provided regarding the incorrect use of the ArgResults API in the new CLI tool, which would cause runtime errors. Additionally, improvements were suggested for error handling in GithubApi by replacing null-assertion operators with a descriptive helper getter for the issue number.

Comment thread pkgs/firehose/bin/comment.dart
Comment thread pkgs/firehose/bin/comment.dart
Comment thread pkgs/firehose/lib/src/github.dart
Comment thread pkgs/firehose/lib/src/github.dart Outdated
Comment thread pkgs/firehose/lib/src/github.dart Outdated
Comment thread pkgs/firehose/lib/src/github.dart Outdated
@kevmoo
Copy link
Copy Markdown
Member Author

kevmoo commented Apr 16, 2026

@mosuem this is ready.

I've ran a few loops through and the comments are still nicely updated

Comment thread .github/workflows/health_base.yaml
Comment thread .github/workflows/health_base.yaml

- name: Install firehose
- name: Install firehose (internal)
if: ${{ !inputs.local_debug && github.repository == 'dart-lang/ecosystem' }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Comment thread .github/workflows/publish.yaml
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:io';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do like using dart scripts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package:firehose type-infra A repository infrastructure change or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants