Skip to content

Commit

Permalink
Merge pull request #22 from JHartzer/main
Browse files Browse the repository at this point in the history
Allow additional arguments to be passed to cloc
  • Loading branch information
djdefi committed Nov 22, 2023
2 parents 7fff80d + 891d3be commit 213f905
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/cloc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

# Runs djdefi/cloc-action@master
# Runs djdefi/cloc-action@main
- name: Count Lines of Code (cloc)
uses: djdefi/cloc-action@main

- name: Count Lines of Code with additional options
uses: djdefi/cloc-action@main
with:
options: --exclude-lang=YML --md --report-file=cloc.md

#- name: Upload cloc output as a build artifact
# uses: actions/upload-artifact@v2
# with:
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
FROM alpine:3.18

ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/entrypoint.sh"]
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/entrypoint.sh"]

RUN apk add --no-cache --update cloc \
dumb-init \
git

COPY entrypoint.sh /
9 changes: 8 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# action.yml
name: 'Count Lines of Code (cloc)'
description: 'Count Lines of Code with https://github.com/AlDanial/cloc'
inputs:
options:
description: 'Additional options to pass to cloc'
required: false
default: ''

runs:
using: 'docker'
image: 'Dockerfile'

args:
- ${{ inputs.options }}

branding:
icon: 'code'
color: 'blue'
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
# Trust workspace
git config --global --add safe.directory "$GITHUB_WORKSPACE"
cloc $(git rev-parse HEAD) | tee -a cloc.txt
cloc $(git rev-parse HEAD) $1 | tee -a cloc.txt

0 comments on commit 213f905

Please sign in to comment.