Skip to content

Commit

Permalink
Only check text files for "do not submit" string (#243)
Browse files Browse the repository at this point in the history
* Only check text files for do not submit string

* Rev version
  • Loading branch information
mosuem authored Mar 12, 2024
1 parent 49a3cbb commit 5a900ca
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5a900ca

Please sign in to comment.