Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only check text files for "do not submit" string #243

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkgs/firehose/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.8.0

- Only check text files for do not submit strings.

## 0.7.0

- Add `ignore-packages` flag to the publish workflow.
Expand Down
4 changes: 4 additions & 0 deletions pkgs/firehose/lib/src/health/health.dart
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,17 @@ Changes to files need to be [accounted for](https://github.com/dart-lang/ecosyst

Future<HealthCheckResult> doNotSubmitCheck() async {
final dns = 'DO_NOT${'_'}SUBMIT';
// To avoid trying to read non-text files.
const supportedExtensions = ['.dart', '.json', '.md', '.txt'];

final body = await github.pullrequestBody();
final files = await github.listFilesForPR(directory, ignoredPackages);
print('Checking for DO_NOT${'_'}SUBMIT strings: $files');
final filesWithDNS = files
.where((file) =>
![FileStatus.removed, FileStatus.unchanged].contains(file.status))
.where((file) =>
supportedExtensions.contains(path.extension(file.filename)))
.where((file) => File(file.pathInRepository)
.readAsStringSync()
.contains('DO_NOT${'_'}SUBMIT'))
Expand Down
2 changes: 1 addition & 1 deletion pkgs/firehose/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: firehose
description: A tool to automate publishing of Pub packages from GitHub actions.
version: 0.7.0
version: 0.8.0
repository: https://github.com/dart-lang/ecosystem/tree/main/pkgs/firehose

environment:
Expand Down
5 changes: 5 additions & 0 deletions pkgs/firehose/test/health_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ Future<void> main() async {
FileStatus.added,
directory,
),
GitFile(
'pkgs/package2/someImage.png',
FileStatus.added,
directory,
),
]);
await Process.run('dart', ['pub', 'global', 'activate', 'dart_apitool']);
await Process.run('dart', ['pub', 'global', 'activate', 'coverage']);
Expand Down
mosuem marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.