Skip to content

Commit

Permalink
feat: adds discover action
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgilman committed Aug 30, 2024
1 parent d776616 commit 81a82f0
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test
on:
push:

permissions:
contents: read
id-token: write

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup
uses: ./forge/actions/setup
with:
forge_version: local
- name: Discovery
id: discovery
uses: ./forge/actions/discovery
with:
filters: |
^check.*
^test.*
- name: Show output
run: echo "${{ steps.discovery.outputs.json }}"
31 changes: 31 additions & 0 deletions forge/actions/discovery/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Discovery
description: Discovers Earthfiles
inputs:
filters:
description: A newline separated list of filters to apply
default: ""
path:
description: The path to search from
default: "."
outputs:
json:
description: The result of the discovery
value: ${{ steps.discover.outputs.json }}
runs:
using: composite
steps:
- name: Discover
id: discover
shell: bash
run: |
FILTERS="${{ inputs.filters }}"
FILTERS="$(echo "${FILTERS}" | tr '\n' ' ' | sed 's/ $//')"
FLAGS=""
for filter in $FILTERS; do
FLAGS+="-f $filter "
done
OUTPUT=$(forge -vvv scan $FLAGS "${{ inputs.path }}" 2> >(tee /dev/stderr))
OUTPUT=$(echo $OUTPUT | jq -rc)
echo "json=$OUTPUT" >> $GITHUB_OUTPUT

0 comments on commit 81a82f0

Please sign in to comment.