Parse T-Rex Files #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Parse T-Rex Files | |
on: | |
schedule: | |
- cron: '0 0 * * 0' # Runs at midnight every Sunday | |
workflow_dispatch: | |
jobs: | |
find-trex-files: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: Find T-Rex files | |
id: find_files | |
run: | | |
# Find all files with 'trex' in their name, ignoring files that start with '.' | |
filename_matches=$(find . -type f -name '*trex*' ! -path './.*') | |
# Find all files with 'trex' in their content, ignoring files that start with '.' | |
content_matches=$(grep -rl 'trex' --exclude-dir='.*') | |
# Combine both results into a single list, removing duplicates | |
combined_results=$(echo -e "$filename_matches\n$content_matches" | sort -u | grep -v '^./\.') | |
# Format the combined results into a YAML array | |
formatted_results=$(echo "$combined_results" | awk '{print "- \"" $0 "\""}') | |
# Write the YAML array to a file | |
echo -e "$formatted_results" > trex_files.yaml | |
# Print the result to the log | |
echo "Files found:" | |
cat trex_files.yaml | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
signoff: true | |
branch: "trex-file-parser" | |
delete-branch: true | |
title: "Trex File Parser" | |
committer: GitHub <[email protected]> | |
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
labels: | | |
ok-to-test | |
reviewers: eemurphy, markturansky, gurnben |