Skip to content

Commit

Permalink
Performance improvement and minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
socheatsok78 committed Jun 5, 2024
1 parent 0596535 commit 511c557
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 29 deletions.
31 changes: 13 additions & 18 deletions dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

23 changes: 13 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,26 @@ const YAML = require("yaml")
const core = require('@actions/core');
const tc = require('@actions/tool-cache');
const { compareVersions } = require('compare-versions');
const { release } = require("node:os");

const runner = {
os: process.env['RUNNER_OS'] || 'Linux',
arch: process.env['RUNNER_ARCH'] || 'x64',
}

const parseStrictInput= (strict = "false") => {
return strict === "true" ? true : false
}

const labelsMap = {
release: "Flutter SDK release matrix",
dart: "Dart SDK",
flutter: "Flutter SDK",
}

const parseStrictInput= (strict = "false") => {
return strict === "true" ? true : false
}

const stripVersionPrefix = (version) => {
return version ? version.replace(/^v/, '') : version
}

async function main() {
const inputs = {
pubspec: core.getInput('pubspec') || './pubspec.yaml',
Expand Down Expand Up @@ -90,8 +93,8 @@ async function main() {
}

const msg = []
let flutter_sdk_version = release.version
let dart_sdk_version = release.dart_sdk_version
let flutter_sdk_version = stripVersionPrefix(release.version)
let dart_sdk_version = stripVersionPrefix(release.dart_sdk_version)

// Check if the release satisfies the version constraint in the pubspec.yaml file
if (flutter_sdk_version) {
Expand All @@ -114,9 +117,9 @@ async function main() {
dart_sdk_version = Pubspec.environment.sdk.replace(/\^|<=?|>=?/, '')
}

// Remove the leading "v" from the versions
flutter_sdk_version = flutter_sdk_version.replace(/^v/, '')
dart_sdk_version = dart_sdk_version.replace(/^v/, '')
// Attempt to remove the leading "v" from the versions, again!
flutter_sdk_version = stripVersionPrefix(flutter_sdk_version)
dart_sdk_version = stripVersionPrefix(dart_sdk_version)

// Add value to outputs
if (!outputs.flutter.includes(flutter_sdk_version)) {
Expand Down

0 comments on commit 511c557

Please sign in to comment.