-
Notifications
You must be signed in to change notification settings - Fork 21
34 lines (31 loc) · 1.44 KB
/
detect-extractors.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Detect Extractors in the Repo
on: push
jobs:
# Don't recursively run the workflow. If the last file that was changed was just publish-extractor.yml, then don't do anything
check-if-job-needs-to-be-run:
runs-on: ubuntu-latest
outputs:
to-run-or-not-to-run: ${{ steps.should-run.outputs.should_run }}
steps:
- uses: actions/checkout@v4
- id: should-run
run: |
if [[ $(git log -1 --name-only --pretty='' --first-parent -m | sed 's/\.github\/workflows\/publish-extractor\.yml//') == '' ]]; then
echo "should_run=no-run" >> "$GITHUB_OUTPUT";
else
echo "should_run=run" >> "$GITHUB_OUTPUT";
fi
detect-extractors:
runs-on: ubuntu-latest
needs: check-if-job-needs-to-be-run
if: needs.check-if-job-needs-to-be-run.outputs.to-run-or-not-to-run == 'run'
outputs:
extractors: ${{ steps.list-extractors.outputs.extractors }}
steps:
- uses: actions/checkout@v4
- id: list-extractors
run: echo "extractors=$(find . -type f -name indexify.yaml -exec dirname {} \; | sed 's/.\// - /')" >> "$GITHUB_VERSION"
- run: sed 's/{{options}}/${{ steps.list-extractors.outputs.extractors }}/' .github/workflows/publish-extractor.template > .github/workflows/publish-extractor.yml
- run: git add .github/workflows/publish-extractor.template
- run: git commit -m "Updated extractor list for publishing"
- run: git push