Skip to content

Commit

Permalink
fix(actions): send metrics on pr and send none values (#4058)
Browse files Browse the repository at this point in the history
  • Loading branch information
haverchuck authored Nov 6, 2023
1 parent 135d7d0 commit 0bc1446
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 58 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions .github/composite_actions/log_cw_metric/dist/main.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .github/composite_actions/log_cw_metric/dist/main.cjs.map

Large diffs are not rendered by default.

10 changes: 1 addition & 9 deletions .github/composite_actions/log_cw_metric_wrapper/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ inputs:
runs:
using: "composite"
steps:
- name: Exit if not scheduled
shell: bash
run: |
if [ "${{ github.event_name }}" != "schedule" ]; then
echo "This was not triggered by a schedule, skipping."
echo "SKIP_CW=true" >> $GITHUB_ENV
fi
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0
if: env.SKIP_CW != 'true'
with:
Expand All @@ -83,7 +75,7 @@ runs:
job-status: ${{ inputs.job-status }}
github-token: ${{ inputs.github-token }}

metric-name: "github_metric_2.0"
metric-name: "github_metric_2.1"
test-type: ${{ inputs.test-type }}
working-directory: ${{ inputs.working-directory }}

Expand Down
41 changes: 21 additions & 20 deletions .github/composite_actions/setup_chromedriver/dist/main.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions .github/composite_actions/setup_chromedriver/dist/main.cjs.map

Large diffs are not rendered by default.

20 changes: 13 additions & 7 deletions actions/bin/log_cw_metric.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import 'package:collection/collection.dart';
Future<void> main(List<String> args) => wrapMain(logMetric);

Future<void> logMetric() async {
const defaultValue = 'none';

// Inputs for Failing Step
final jobStatus = core.getRequiredInput('job-status');

Expand Down Expand Up @@ -104,19 +106,22 @@ Future<void> logMetric() async {

final workflowName = '${github.context.workflow}/${github.context.job}';

final framework = core.getInput('framework', defaultValue: '');
final framework = core.getInput('framework', defaultValue: defaultValue);
if (!['dart', 'flutter'].contains(framework)) {
throw Exception(
'framework input of $framework must be one of: dart, flutter',
);
}
final flutterDartChannel =
core.getInput('flutter-dart-channel', defaultValue: '');
final dartVersion = core.getInput('dart-version', defaultValue: '');
final flutterVersion = core.getInput('flutter-version', defaultValue: '');
final dartCompiler = core.getInput('dart-compiler', defaultValue: '');
final platform = core.getInput('platform', defaultValue: '');
final platformVersion = core.getInput('platform-version', defaultValue: '');
core.getInput('flutter-dart-channel', defaultValue: defaultValue);
final dartVersion = core.getInput('dart-version', defaultValue: defaultValue);
final flutterVersion =
core.getInput('flutter-version', defaultValue: defaultValue);
final dartCompiler =
core.getInput('dart-compiler', defaultValue: defaultValue);
final platform = core.getInput('platform', defaultValue: defaultValue);
final platformVersion =
core.getInput('platform-version', defaultValue: defaultValue);

final value = isFailed ? '1' : '0';

Expand All @@ -131,6 +136,7 @@ Future<void> logMetric() async {
'dart-compiler': dartCompiler,
'platform': platform,
'platform-version': platformVersion,
'event-name': github.context.eventName,
//if (failingStep.isNotEmpty) 'failing-step': failingStep,
};

Expand Down
2 changes: 1 addition & 1 deletion actions/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ environment:
sdk: ^3.2.0-150.0.dev

dependencies:
aws_common: any
aws_common: ^0.6.1
collection: ^1.18.0
js: ^0.6.7
json_annotation: ">=4.8.1 <4.9.0"
Expand Down

0 comments on commit 0bc1446

Please sign in to comment.