Skip to content

Instantly share code, notes, and snippets.

@graffhyrum
Created November 1, 2024 16:46
Show Gist options
  • Save graffhyrum/a6e94ac66ae0cc6b0be96f9e4acbd8cd to your computer and use it in GitHub Desktop.
Save graffhyrum/a6e94ac66ae0cc6b0be96f9e4acbd8cd to your computer and use it in GitHub Desktop.
A Github Action that provides debug information about file paths.
name: 'Find My File'
description: 'Action that provides debug information about file paths'
inputs:
runnerOs:
description: 'The runner operating system'
required: true
filename:
description: 'The filename to search for'
required: true
default: 'README.md'
runs:
using: "composite"
steps:
- name: Debug Path Info (Windows)
if: inputs.runnerOs == 'Windows'
shell: pwsh
env:
SEARCH_FILE: ${{ inputs.filename }}
run: |
Write-Host "GITHUB_WORKSPACE: $env:GITHUB_WORKSPACE"
Write-Host "Current Location:"
Get-Location
Write-Host "Directory Contents:"
Get-ChildItem -Recurse -Filter "$env:SEARCH_FILE"
- name: Debug Path Info (Linux/Mac)
if: inputs.runnerOs != 'Windows'
shell: bash
env:
SEARCH_FILE: ${{ inputs.filename }}
run: |
echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE"
echo "Current Location:"
pwd
echo "Directory Contents:"
find . -name "$SEARCH_FILE"
name: Example Workflow
on: [push]
jobs:
debug-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: your-org/your-action@v1
with:
runnerOs: Windows
filename: my-custom-file.ps1
debug-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: your-org/your-action@v1
with:
runnerOs: Linux
filename: my-custom-file.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment