From 0aabe5b2837c72abfee70bca4fbded5fe0555f70 Mon Sep 17 00:00:00 2001 From: Andrew Simard <41052272+500Foods@users.noreply.github.com> Date: Sun, 26 Nov 2023 18:15:38 -0800 Subject: [PATCH] Update main.yml --- .github/workflows/main.yml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8164871..b7873bb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,12 +14,38 @@ jobs: cloc: # The type of runner that the job will run on runs-on: ubuntu-latest + + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the + # added or changed files to the repository. + contents: write # Steps represent a sequence of tasks that will be executed as part of the job steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 # Runs djdefi/cloc-action - name: Count Lines of Code (cloc) - uses: djdefi/cloc-action@5 + uses: djdefi/cloc-action@main + with: + options: --report-file=cloc.txt + + # Copy the new cloc.txt contents into the README.md file at the appropriate spot + - run: csplit README.md /\<\!--CLOC/ {1} + - run: cp xx00 README.md + - run: echo "" >> README.md + - run: echo "\`\`\`" >> README.md + - run: echo "NOW=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_ENV + - run: echo "Last Updated at ${{ env.NOW }}" >> README.md + - run: tail -n +2 cloc.txt >> README.md + - run: echo "\`\`\`" >> README.md + - run: cat xx02 >> README.md + + # Save the output back to the repository + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + skip_dirty_check: true + branch: main + file_pattern: 'README.md'