Added many, many more actions.
This commit is contained in:
28
utils/shasum-files/action.yaml
Normal file
28
utils/shasum-files/action.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
name: shasum-files
|
||||
description: "Output the shasum of files in a directory matching a pattern."
|
||||
inputs:
|
||||
directory:
|
||||
description: "Directory to search."
|
||||
required: true
|
||||
default: '.'
|
||||
pattern:
|
||||
description: "Pattern of files to search for."
|
||||
required: true
|
||||
default: '*'
|
||||
outputs:
|
||||
sums:
|
||||
description: "The sums of the files matching the pattern."
|
||||
value: ${{ steps.sums.outputs.sums }}
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Get sums of files matching the pattern"
|
||||
id: sums
|
||||
run: |
|
||||
OUTPUT=$(bash ${{ github.action_path }}/get_sums.sh "${{ inputs.directory }}" "${{ inputs.pattern }}")
|
||||
if [[ -n "$OUTPUT" ]]; then
|
||||
echo "sums<<EOF" >> "$GITHUB_OUTPUT"
|
||||
echo "$OUTPUT" >> "$GITHUB_OUTPUT"
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
shell: bash
|
||||
12
utils/shasum-files/get_sums.sh
Normal file
12
utils/shasum-files/get_sums.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
# Get the directory and pattern as arguments
|
||||
DIR=$1
|
||||
PATTERN=$2
|
||||
|
||||
find "$DIR" -type f -name "$PATTERN" -print0 | while IFS= read -r -d '' file; do
|
||||
# compute the sha256 hash of the file using sha256sum command
|
||||
HASH=$(sha256sum "$file" | cut -d " " -f1)
|
||||
NAME=$(basename "$file")
|
||||
# print the file name and hash to a temporary file
|
||||
echo "$NAME: $HASH"
|
||||
done
|
||||
Reference in New Issue
Block a user