Merge pull request #183 from BIH-CEI/179-read-hierarchical-data #91
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 LOC in Python Files | |
on: | |
push: | |
branches: [ develop ] | |
pull_request: | |
branches: [ main, develop ] | |
jobs: | |
count-loc: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Count Total Lines of Code in Python Files | |
id: loc # Give this step an ID to reference later | |
run: | | |
echo "Counting total lines of Python code..." | |
LOC_COUNT=$(git ls-files '*.py' | xargs wc -l | tail -n 1) | |
echo "LOC_COUNT=${LOC_COUNT}" >> $GITHUB_ENV | |
echo "Python Lines of Code (LOC): $LOC_COUNT" | |
- name: Post LOC Count as PR Comment (Only for Main Branch) | |
if: github.event_name == 'pull_request' && github.base_ref == 'main' | |
uses: peter-evans/create-or-update-comment@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
### Python Lines of Code (LOC) Summary | |
Total lines of Python code in this repository: | |
``` | |
${{ env.LOC_COUNT }} | |
``` | |
- name: Create Badge | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 25d4f4d4d222fcb5f266a280b1dd60d4 | |
filename: phenopacket_mapper_locs.JSON # Use test.svg if you want to use the SVG mode. | |
label: Lines of Code | |
message: ${{ env.LOC_COUNT }} | |
color: blue | |