From 9adaa71b2a498cbdc1776adc06308ca96925c929 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Sat, 1 Feb 2025 12:29:41 -0500 Subject: [PATCH] allow to skip preconditions --- Taskfile.yaml | 25 +++++++++++++++++++++---- contrib/check_changelog.fish | 5 +++++ contrib/check_new_tests.fish | 5 +++++ 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100755 contrib/check_changelog.fish create mode 100755 contrib/check_new_tests.fish diff --git a/Taskfile.yaml b/Taskfile.yaml index 150dd59..c3e87eb 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -3,6 +3,9 @@ # tea releases c --asset releases/updux-4.0.0-alpha.2.tgz -p --title v4.0.0-alpha.2 --tag v4.0.0-alpha.2 version: '3' +env: + SHELL: /usr/local/bin/fish + vars: PARENT_BRANCH: main @@ -42,13 +45,17 @@ tasks: integrate: deps: [checks] + env: + NO_NEW_TESTS: '{{.NO_NEW_TESTS}}' + NO_CHANGELOG: '{{.NO_CHANGELOG}}' + PARENT_BRANCH: '{{.PARENT_BRANCH}}' preconditions: - sh: git is-clean msg: Workspace is not clean - - sh: git diff-ls {{.PARENT_BRANCH}} | grep test - msg: No test added - - sh: git diff-ls main | grep .changeset/ - msg: No new changeset + - sh: ./contrib/check_new_tests.fish + msg: No test added (NO_NEW_TESTS to disable) + - sh: ./contrib/check_changelog.fish + msg: No new changeset (NO_CHANGELOG to disable) cmds: - git checkout {{.PARENT_BRANCH}} - git weld - @@ -57,6 +64,16 @@ tasks: test:dev: vitest src + foo: + env: + NO_NEW_TESTS: '{{.NO_NEW_TESTS}}' + PARENT_BRANCH: '{{.PARENT_BRANCH}}' + cmds: + - echo $SHELL + - echo {{.NO_NEW_TESTS}} + - echo $NO_NEW_TESTS + - ./contrib/check_new_tests.fish + lint:fix:delta: vars: FILES: diff --git a/contrib/check_changelog.fish b/contrib/check_changelog.fish new file mode 100755 index 0000000..0b8dc57 --- /dev/null +++ b/contrib/check_changelog.fish @@ -0,0 +1,5 @@ +#!/usr/bin/env fish + +if test -z "$NO_CHANGELOG" + git diff-ls main | grep .changeset/ ; +end diff --git a/contrib/check_new_tests.fish b/contrib/check_new_tests.fish new file mode 100755 index 0000000..8e0c55c --- /dev/null +++ b/contrib/check_new_tests.fish @@ -0,0 +1,5 @@ +#!/usr/bin/env fish + +if test -z "$NO_NEW_TESTS" + git diff-ls $PARENT_BRANCH | grep test +end