Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow additional arguments to be passed to cloc #22

Merged
merged 2 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading