feat: solve problem 226 #22
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: Count solved problem | |
on: | |
push: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
count: | |
name: Count solved problem | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref_name }} | |
- name: Count files | |
id: count_files | |
run: | | |
file_count=$(find . -type f ! -path './.*' ! -path './.*/*' ! -name 'README.md' | wc -l) | |
echo "File count: $file_count" | |
echo "::set-output name=file_count::$file_count" | |
- name: Update README | |
run: | | |
file_count=${{ steps.count_files.outputs.file_count }} | |
readme_content=$(cat << EOF | |
# LeetCode | |
Try hard leet code every day to improve level | |
[ Leetcode profile ](https://leetcode.com/u/orgball2608/) | |
## Problem solved | |
**$file_count** problem. | |
EOF | |
) | |
echo "$readme_content" > README.md | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Update README with file count | |
commit_author: GitHub <41898282+github-actions[bot]@users.noreply.github.com> | |
branch: ${{ github.ref_name }} |