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

View File

@@ -0,0 +1,84 @@
name: mc-find-tags
description: "Find files in s3."
inputs:
accessKey:
description: "S3 access key."
required: true
secretKey:
description: "S3 secret key."
required: true
alias:
description: "S3 alias."
required: true
url:
description: "S3 url."
required: true
default: https://s3-us-gov-west-1.amazonaws.com
path:
description: "The path to search for."
required: true
name:
description: "The name pattern to search for."
required: true
default: ""
tags:
description: "The tags/version to search for."
required: true
default: ""
additionalArgs:
description: "Additional arguments."
required: false
outputs:
files:
description: "The path of the found file."
value: ${{ steps.output.outputs.files }}
console:
description: "The console output of the command."
value: ${{ steps.output.outputs.console }}
success:
description: "Whether files were found."
value: ${{ steps.output.outputs.success }}
runs:
using: "composite"
steps:
- name: "Build command."
id: command
run: |
COMMAND="find \"${{ inputs.path }}\" ${{ inputs.additionalArgs }}"
echo "command=$COMMAND" >> "$GITHUB_OUTPUT"
if [[ -n "${{ inputs.name }}" ]]; then
COMMAND="$COMMAND --name \"${{ inputs.name }}\""
fi
if [[ -n "${{ inputs.tags }}" ]]; then
COMMAND="$COMMAND --exec \"mc tag list {}\""
fi
shell: bash
- name: "Find file in S3."
id: find
uses: act/common/minio/mc@master
with:
alias: ${{ inputs.alias }}
command: ${{ steps.command.outputs.command }}
accessKey: ${{ inputs.accessKey }}
secretKey: ${{ inputs.secretKey }}
url: ${{ inputs.url }}
catchErrors: true
- name: "Set output."
id: output
run: |
RESULT="${{ steps.find.outputs.exitCode }}"
if [[ "$RESULT" != "0" ]]; then
SUCCESS="false"
else
echo "console<<EOF" >> "$GITHUB_OUTPUT"
echo "${{ steps.find.outputs.console }}" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
SUCCESS="true"
fi
echo "success=$SUCCESS" >> "$GITHUB_OUTPUT"
shell: bash

View File

@@ -0,0 +1,37 @@
MINIO_URL="$1"
MINIO_ALIAS="$2"
OUTPUT=$(cat <<EOF
$3
EOF
)
IDS=""
URLS=""
TAGS=""
while read -r line; do
if [[ $line == "Name"* ]]; then
# Collapes the spaces.
COLLAPSED=$(echo "$line" | tr -s " ")
# Split the string by spaces.
URL=$(echo "$COLLAPSED" | cut -d " " -f 3)
ID=$(echo "$COLLAPSED" | cut -d " " -f 4 | tr -d "()")
URLS+="$URL "
IDS+="$ID "
TAGS="${TAGS%?} "
else
VARNAME=$(echo "$line" | cut -d ":" -f 1 | xargs)
VARVAL=$(echo "$line" | cut -d ":" -f 2 | xargs)
TAGS+="$VARNAME=$VARVAL&"
fi
done <<< "$OUTPUT"
# Remove last amperstand.
TAGS=$(echo "${TAGS%?}")
# Remove first space.
TAGS=$(echo "${TAGS/ /}")
URLS=$(echo "$URLS" | xargs)
ALIASED_URLS=$(echo "$URLS" | sed -e "s|^$MINIO_URL|$MINIO_ALIAS|g" | xargs)
echo "tags=$TAGS" >> "$GITHUB_OUTPUT"
echo "urls=$URLS" >> "$GITHUB_OUTPUT"
echo "aliasedUrls=$ALIASED_URLS" >> "$GITHUB_OUTPUT"