Skip to content

Commit

Permalink
✨ Treat integration run with special upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
MicahElliott committed Oct 20, 2023
1 parent 83c43d6 commit a2456ad
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/zsh-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ jobs:
run: sudo apt-get update; sudo apt-get install zsh
- name: Set path in env
run: echo "PATH=$PATH:/home/runner/work/captain/captain" >> $GITHUB_ENV
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
ruby-version: '3.1'
bundler-cache: true
- name: Install markdownlint
run: gem install mdl
- name: Zsh-huh
run: |
# print "in zsh, name, version: $ZSH_NAME, $ZSH_VERSION"
Expand All @@ -22,7 +29,7 @@ jobs:
pwd
ls
tree
./capt pre-commit
./capt integration
# - name: Run a zsh script as proof
# # run: .github/bin/zsh_proof.sh
# run: tree
Expand Down
16 changes: 10 additions & 6 deletions capt
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ setup_changes() {
print -n " $fg_bold[magenta][⎇ $upstream]$reset_color"
# CAPT_FILES_CHANGED=( $(git diff --name-only --cached origin/$main_branch) )
# CAPT_FILES_CHANGED_ORIG=( $(git diff --name-only --cached $upstream) )
CAPT_FILES_CHANGED_ORIG=( $(git diff --name-only --cached) )
if [[ $active_githook = 'integration' ]]; then
aye "Using special upstream for integration run: $bold_color$special_integration_upstream$reset_color"
special_integration_upstream=$upstream # remains unset as no-arg for next line
fi
CAPT_FILES_CHANGED_ORIG=( $(git diff --name-only --cached $special_integration_upstream) )
CAPT_FILES_CHANGED=( $CAPT_FILES_CHANGED_ORIG )
# aye "[Δ Staged files changed ($#CAPT_FILES_CHANGED)]: $bold_color$CAPT_FILES_CHANGED$reset_color"
if (( $#CAPT_FILES_CHANGED > 0 )); then
Expand Down Expand Up @@ -270,13 +274,13 @@ run_scripts () {
# print_name=$(ssed 's/[:(].*//' <<<$name)
print_name=$(print $name | ssed 's/[:(].*//' )
# print
ayen "$fg[yellow]⚳⚳⚳ ${(U)print_name} ⚳⚳⚳$reset_color" # hooks
ayen "$fg[yellow]⚳⚳⚳ ${(U)print_name} ⚳⚳⚳$reset_color" # uhooks
if [[ ! $name == *: ]]; then dbg "built-in plain checker with no spec:" $name
# Need to fix up cmd since no spec, and maybe include filtered files
script=$inv[1]
just_buitins=${(k)builtin_cannons}
if ! (($just_buitins[(Ie)$name])); then
print; aye "$fg[red]ERROR: Unable to find built-in: $bold_color$name$reset_color" ; exit 1
print; aye "$fg[red]ERROR: Unable to find built-in trigger: $bold_color$name$reset_color" ; exit 1
fi
# NAME FILTER CMD
# User spec is like: markdownlint(md|mkd): mdl ...
Expand All @@ -294,7 +298,7 @@ run_scripts () {
then filtered_files=( $CAPT_FILES_CHANGED )
else filtered_files=( $(print -l $CAPT_FILES_CHANGED | sgrep -E "\.$filter$") ); fi
if [[ $#filtered_files < 1 && -n $CAPT_FILES_CHANGED ]]; then
print " (Not seein any matchin files staged, skippin.)"
print " (Not seein any matchin files staged, skippin.)"
continue
fi
# TODO Add special casing for specific hooks needing special treatment
Expand All @@ -312,14 +316,14 @@ run_scripts () {
dbg CAPT_FILES_CHANGED: $CAPT_FILES_CHANGED
filtered_files=( $(print -l $CAPT_FILES_CHANGED | sgrep -E "\.$filter$") )
CAPT_FILES_CHANGED=( $filtered_files )
if [[ $#filtered_files < 1 ]]; then print " (Not seein any matchin files staged, skippin.)"; continue
if [[ $#filtered_files < 1 ]]; then print " (Not seein any matchin files staged, skippin.)"; continue
else
print_filtereds $filtered_files
aye "$bold_color$cmd$reset_color" # heart
fi
elif [[ $line == *CAPT_FILES_CHANGED* || ! $name == *: ]]; then dbg "unfiltered checker"
filtered_files=( $CAPT_FILES_CHANGED )
if [[ $#filtered_files < 1 ]]; then print " (Not seein any matchin files staged, skippin.)"; continue
if [[ $#filtered_files < 1 ]]; then print " (Not seein any matchin files staged, skippin.)"; continue
else
print_filtereds $CAPT_FILES_CHANGED
aye "$bold_color$cmd$reset_color" # diamond
Expand Down

0 comments on commit a2456ad

Please sign in to comment.