diff --git a/.github/workflows/self-dev.yml b/.github/workflows/self-dev.yml index b97e989..9ed19cb 100644 --- a/.github/workflows/self-dev.yml +++ b/.github/workflows/self-dev.yml @@ -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 diff --git a/actions/count-lines-docker/action.yml b/actions/count-lines-docker/action.yml new file mode 100644 index 0000000..484661a --- /dev/null +++ b/actions/count-lines-docker/action.yml @@ -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 }} diff --git a/scripts/count-lines.Dockerfile b/scripts/count-lines.Dockerfile new file mode 100644 index 0000000..0cd82f1 --- /dev/null +++ b/scripts/count-lines.Dockerfile @@ -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"]