Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Add ignore flag for publish.yaml
  • Loading branch information
mosuem committed Feb 7, 2024
commit 2aa6962e15fa9b2a91efc57dfa3e2d1cee513209
10 changes: 9 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ on:
default: false
required: false
type: boolean
ignore-packages:
description: Which packages to ignore.
default: "\"\""
required: false
type: string

jobs:
# Note that this job does not require the specified environment.
Expand Down Expand Up @@ -119,7 +124,10 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.number }}
PR_LABELS: "${{ join(github.event.pull_request.labels.*.name) }}"
run: dart pub global run firehose --validate ${{ fromJSON('{"true":"--use-flutter","false":"--no-use-flutter"}')[inputs.use-flutter] }}
run: dart pub global run firehose \
--validate \
${{ fromJSON('{"true":"--use-flutter","false":"--no-use-flutter"}')[inputs.use-flutter] }} \
--ignore-packages ${{ inputs.ignore-packages }}

- name: Get comment id
if: ${{ (hashFiles('output/comment.md') != '') && inputs.write-comments }}
Expand Down
7 changes: 6 additions & 1 deletion pkgs/firehose/bin/firehose.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'dart:io';
import 'package:args/args.dart';
import 'package:firehose/firehose.dart';
import 'package:firehose/src/github.dart';
import 'package:glob/glob.dart';

const helpFlag = 'help';
const validateFlag = 'validate';
Expand All @@ -26,6 +27,10 @@ void main(List<String> arguments) async {
final validate = argResults[validateFlag] as bool;
final publish = argResults[publishFlag] as bool;
final useFlutter = argResults[useFlutterFlag] as bool;
final ignoredPackages = (argResults['ignore-packages'] as List<String>)
.where((pattern) => pattern.isNotEmpty)
.map((pattern) => Glob(pattern, recursive: true))
.toList();

if (!validate && !publish) {
_usage(argParser,
Expand All @@ -41,7 +46,7 @@ void main(List<String> arguments) async {
exit(1);
}

final firehose = Firehose(Directory.current, useFlutter);
final firehose = Firehose(Directory.current, useFlutter, ignoredPackages);

if (validate) {
await firehose.validate();
Expand Down
8 changes: 3 additions & 5 deletions pkgs/firehose/lib/firehose.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ const String _ignoreWarningsLabel = 'publish-ignore-warnings';
class Firehose {
final Directory directory;
final bool useFlutter;
final List<Glob> ignoredPackages;

Firehose(this.directory, this.useFlutter);
Firehose(this.directory, this.useFlutter, this.ignoredPackages);

/// Validate the packages in the repository.
///
Expand Down Expand Up @@ -92,10 +93,7 @@ Saving existing comment id $existingCommentId to file ${idFile.path}''');
github.close();
}

Future<VerificationResults> verify(
GithubApi github, [
List<Glob> ignoredPackages = const [],
]) async {
Future<VerificationResults> verify(GithubApi github) async {
var repo = Repository(directory);
var packages = repo.locatePackages(ignoredPackages);

Expand Down
2 changes: 1 addition & 1 deletion pkgs/firehose/lib/src/health/health.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class Health {
Future<HealthCheckResult> validateCheck() async {
//TODO: Add Flutter support for PR health checks
var results =
await Firehose(directory, false).verify(github, ignoredPackages);
await Firehose(directory, false, ignoredPackages).verify(github);

var markdownTable = '''
| Package | Version | Status |
Expand Down