Skip to content

Commit

Permalink
Dockerized version of the count-lines-docker action
Browse files Browse the repository at this point in the history
  • Loading branch information
tomitheninja committed Sep 26, 2024
1 parent be30b6e commit 68a07fb
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/self-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,17 @@ jobs:
- name: Generate summary
run: |
echo 'There are ${{ steps.counter.outputs.line_count }} lines in this project' >> $GITHUB_STEP_SUMMARY
count-lines-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: ${{ env.COUNT_LINES_REPO }}
- uses: kir-dev/automations/actions/count-lines-docker@main
id: counter
with:
target_directory: .
- name: Generate summary
run: |
echo 'There are ${{ steps.counter.outputs.line_count }} lines in this project' >> $GITHUB_STEP_SUMMARY
19 changes: 19 additions & 0 deletions actions/count-lines-docker/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Count Lines Docker"
description: "Counts the number of lines in a specified directory and outputs the result."
inputs:
target_directory:
description: "The directory to count lines in"
required: true
ignore_rule:
description: "Rule to apply for ignoring files: 'git' for .gitignore, 'hidden' for hidden directories, or 'none' for no exclusions."
required: true
default: "git"
outputs:
line_count:
description: "The number of lines counted in the directory"
runs:
using: docker
image: ../../scripts/count-lines.Dockerfile
args:
- ${{ inputs.target_directory }}
- ${{ inputs.ignore_rule }}
7 changes: 7 additions & 0 deletions scripts/count-lines.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM alpine:3.10

RUN apk add --no-cache bash git findutils coreutils tree

COPY ./count-lines.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]

0 comments on commit 68a07fb

Please sign in to comment.