Added find and find-first.
This commit is contained in:
75
utils/find-first/action.yaml
Normal file
75
utils/find-first/action.yaml
Normal file
@@ -0,0 +1,75 @@
|
||||
name: find-first
|
||||
description: "Find the first file matching a pattern and extract detailed information about it."
|
||||
inputs:
|
||||
path:
|
||||
description: "Path to search in."
|
||||
required: false
|
||||
default: "."
|
||||
pattern:
|
||||
description: "Pattern to search for (supports glob patterns)."
|
||||
required: true
|
||||
type:
|
||||
description: "Type of files to find (f=files, d=directories, l=links)."
|
||||
required: false
|
||||
default: "f"
|
||||
maxDepth:
|
||||
description: "Maximum depth to search."
|
||||
required: false
|
||||
default: ""
|
||||
minDepth:
|
||||
description: "Minimum depth to search."
|
||||
required: false
|
||||
default: ""
|
||||
size:
|
||||
description: "Size constraint (e.g., +100k, -1M)."
|
||||
required: false
|
||||
default: ""
|
||||
modified:
|
||||
description: "Modified time constraint (e.g., -1, +7)."
|
||||
required: false
|
||||
default: ""
|
||||
additionalArgs:
|
||||
description: "Additional arguments to pass to find command."
|
||||
required: false
|
||||
default: ""
|
||||
outputs:
|
||||
found:
|
||||
description: "Whether a file was found (true/false)."
|
||||
value: ${{ steps.extract.outputs.found }}
|
||||
fullPath:
|
||||
description: "Full path of the first found file."
|
||||
value: ${{ steps.extract.outputs.fullPath }}
|
||||
directory:
|
||||
description: "Directory containing the file."
|
||||
value: ${{ steps.extract.outputs.directory }}
|
||||
directoryName:
|
||||
description: "Name of the directory containing the file."
|
||||
value: ${{ steps.extract.outputs.directoryName }}
|
||||
fileName:
|
||||
description: "Full filename with extension."
|
||||
value: ${{ steps.extract.outputs.fileName }}
|
||||
baseName:
|
||||
description: "Filename without extension."
|
||||
value: ${{ steps.extract.outputs.baseName }}
|
||||
extension:
|
||||
description: "File extension (without dot)."
|
||||
value: ${{ steps.extract.outputs.extension }}
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Find files."
|
||||
id: find
|
||||
uses: act/common/utils/find@master
|
||||
with:
|
||||
path: ${{ inputs.path }}
|
||||
pattern: ${{ inputs.pattern }}
|
||||
type: ${{ inputs.type }}
|
||||
maxDepth: ${{ inputs.maxDepth }}
|
||||
minDepth: ${{ inputs.minDepth }}
|
||||
size: ${{ inputs.size }}
|
||||
modified: ${{ inputs.modified }}
|
||||
additionalArgs: ${{ inputs.additionalArgs }}
|
||||
- name: "Extract information about first file."
|
||||
id: extract
|
||||
run: sh "${{ github.action_path }}/find-first.sh" "${{ steps.find.outputs.files }}"
|
||||
shell: bash
|
||||
Reference in New Issue
Block a user