Added many, many more actions.

This commit is contained in:
2025-06-24 15:24:16 -07:00
parent 62fbe4dead
commit 57ef232d2b
108 changed files with 4212 additions and 7 deletions

44
yq/yq-trim/action.yaml Normal file
View File

@@ -0,0 +1,44 @@
name: yq-trim
description: "Change the language format of a file."
inputs:
input:
description: "Left-hand side of merge."
required: true
recursive:
description: "Recursivevly trim the input. Default: true"
required: true
default: "true"
tmpDir:
description: "Temporary directory. Default: _tmp"
required: true
default: _tmp
outputs:
result:
description: "The converted file."
value: ${{ steps.trim.outputs.console }}
runs:
using: "composite"
steps:
- name: "Make temporary file of input."
id: input
uses: act/common/utils/mktemp@master
with:
input: ${{ inputs.input }}
tmpDir: ${{ inputs.tmpDir }}
- name: "Make temporary file of script."
id: script
uses: act/common/utils/mktemp@master
with:
input: ${{ github.action_path }}/trim.sh
tmpDir: .
- name: "Run script."
id: trim
uses: act/common/yq/yq@master
with:
program: bash
command: ${{ steps.script.outputs.tmp }} ${{ steps.input.outputs.tmp }} ${{ inputs.recursive }}
- name: "Remove temporary files."
run: |
rm "${{ steps.script.outputs.tmp }}"
rm -rf "${{ inputs.tmpDir }}"
shell: bash

16
yq/yq-trim/trim.sh Normal file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
INPUT="$1"
RECURSIVE="$2"
if [[ -f "$INPUT" ]]; then
INPUT=$(cat "$INPUT")
fi
OUTPUT=$(echo "$INPUT" | yq e 'del(.. | select(length == 0))')
if [[ "$RECURSIVE" == "true" ]]; then
while [ "$(echo "$OUTPUT" | yq e 'map (.. | select (length == 0)) | any')" = "true" ]; do
OUTPUT=$(echo "$OUTPUT" | yq e 'del (.. | select (length == 0))')
done
fi
echo "$OUTPUT"