chore: add check if path is a dir #64
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: Update README | |
on: | |
push: | |
branches: [main] | |
permissions: | |
contents: write | |
jobs: | |
count_code_line: | |
name: Count Code Line | |
runs-on: ubuntu-latest | |
outputs: | |
count: ${{ steps.cnt.outputs.line_count }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- id: cnt | |
run: | | |
line_count=$(find . -regex ".*/src/.*\.java" | xargs cat | wc -l) | |
echo "$line_count lines of code" | |
echo "line_count=$line_count" >> "$GITHUB_OUTPUT" | |
update_readme: | |
name: Update README | |
runs-on: ubuntu-latest | |
needs: [count_code_line] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Update README | |
run: | | |
echo "${{ needs.count_code_line.outputs.count }} lines of code" | |
echo "\`\`\`" > README.md | |
echo "Java Line Count: ${{ needs.count_code_line.outputs.count }}" >> README.md | |
echo "\`\`\`" >> README.md | |
- name: Get Last Commit Message | |
id: last-commit | |
run: | | |
echo "message=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT | |
echo "author=$(git log -1 --pretty=\"%an <%ae>\")" >> $GITHUB_OUTPUT | |
echo "$message" | |
echo "$author" | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_author: ${{ steps.last-commit.outputs.author }} | |
commit_message: ${{ steps.last-commit.outputs.message }} | |
commit_options: '--amend --no-edit' | |
push_options: '--force' | |
skip_fetch: true | |
file_pattern: '*.md' | |
disable_globbing: true |