mirror of
https://github.com/ivuorinen/actions.git
synced 2026-02-24 23:51:27 +00:00
feat: add GitHub Actions workflows for code quality and automation (#2)
This commit is contained in:
36
common-file-check/README.md
Normal file
36
common-file-check/README.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# ivuorinen/actions/common-file-check
|
||||
|
||||
## Common File Check
|
||||
|
||||
### Description
|
||||
|
||||
A reusable action to check if a specific file or type of files exists in the repository.
|
||||
Emits an output 'found' which is true or false.
|
||||
|
||||
### Inputs
|
||||
|
||||
| name | description | required | default |
|
||||
| -------------- | --------------------------------------- | -------- | ------- |
|
||||
| `file-pattern` | <p>Glob pattern for files to check.</p> | `true` | `""` |
|
||||
|
||||
### Outputs
|
||||
|
||||
| name | description |
|
||||
| ------- | -------------------------------------------------------------- |
|
||||
| `found` | <p>Indicates if the files matching the pattern were found.</p> |
|
||||
|
||||
### Runs
|
||||
|
||||
This action is a `composite` action.
|
||||
|
||||
### Usage
|
||||
|
||||
```yaml
|
||||
- uses: ivuorinen/actions/common-file-check@main
|
||||
with:
|
||||
file-pattern:
|
||||
# Glob pattern for files to check.
|
||||
#
|
||||
# Required: true
|
||||
# Default: ""
|
||||
```
|
||||
33
common-file-check/action.yml
Normal file
33
common-file-check/action.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
|
||||
name: Common File Check
|
||||
description: |
|
||||
A reusable action to check if a specific file or type of files exists in the repository.
|
||||
Emits an output 'found' which is true or false.
|
||||
author: 'Ismo Vuorinen'
|
||||
branding:
|
||||
icon: search
|
||||
color: gray-dark
|
||||
|
||||
inputs:
|
||||
file-pattern:
|
||||
description: 'Glob pattern for files to check.'
|
||||
required: true
|
||||
|
||||
outputs:
|
||||
found:
|
||||
description: 'Indicates if the files matching the pattern were found.'
|
||||
value: ${{ steps.check-files.outputs.found }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Check for Files
|
||||
id: check-files
|
||||
shell: bash
|
||||
run: |
|
||||
if find . -name "${{ inputs.file-pattern }}" | grep -q .; then
|
||||
echo "found=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "found=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
Reference in New Issue
Block a user