Skip to content
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
6 changes: 5 additions & 1 deletion .github/workflows/entrypoint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
test-entrypoint:
runs-on: ubuntu-latest
container:
image: silkeh/clang:21
image: silkeh/clang:18
steps:
- uses: actions/checkout@v5
- name: Basic command works
Expand All @@ -36,4 +36,8 @@ jobs:
echo "file2.c should not be checked"
exit 9
fi
if ! grep -q "clang-format version:" output; then
echo "Version should be displayed in output"
exit 10
fi
echo "Basic command works"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM silkeh/clang:21
FROM silkeh/clang:18

LABEL maintainer="RafikFarhad<rafikfarhad@gmail.com>"

Expand Down
16 changes: 16 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ The style for `clang-format`. Possible values are: `LLVM, GNU, Google, Chromium,

Default: `LLVM`

## Outputs

### `clang-format-version`
The version of clang-format used by this action. This can be useful when you need to verify which version ran or use it in subsequent workflow steps.

Example usage:
```yaml
- uses: RafikFarhad/clang-format-github-action@v6
id: clang-format
with:
sources: "src/**/*.h,src/**/*.c"

- run: echo "Formatted with clang-format version ${{ steps.clang-format.outputs.clang-format-version }}"
```

## Sample Workflow File
Create a file in `.github/workflows/` folder with:

Expand Down Expand Up @@ -61,6 +76,7 @@ Use older versions for specific `clang-format` versions.
|---------|---------------|
| 21 | RafikFarhad/clang-format-github-action@v6 |
| 19 | RafikFarhad/clang-format-github-action@v5 |
| 18 | RafikFarhad/clang-format-github-action@v4.1 |
| 16 | RafikFarhad/clang-format-github-action@v4 |
| 14 | RafikFarhad/clang-format-github-action@v3 |
| 12 | RafikFarhad/clang-format-github-action@v2.1.0 |
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ inputs:
Paths to exclude separated by comma (`,`)
required: false
default: ""
outputs:
clang-format-version:
description: The version of clang-format used by this action
runs:
using: docker
image: Dockerfile
3 changes: 3 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ function find_cmd() {

function main() {
log "Action started"
CLANG_FORMAT_VERSION=$(clang-format --version | head -n 1)
log "clang-format version: $CLANG_FORMAT_VERSION"
echo "clang-format-version=$CLANG_FORMAT_VERSION" >> "$GITHUB_OUTPUT"
resolve_inputs
log "Sources to check: $INPUT_SOURCES"
if [ -n "$INPUT_EXCLUDES" ]; then
Expand Down