-
Notifications
You must be signed in to change notification settings - Fork 22
47 lines (41 loc) · 1.28 KB
/
format_and_update_hash.yaml
File metadata and controls
47 lines (41 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Format and Update Hash
on:
pull_request:
branches:
- master
jobs:
format-and-update:
runs-on: ubuntu-latest
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
# Step 1: Run clang-format linter (in place)
- name: Run clang-format
uses: DoozyX/clang-format-lint-action@v0.20
with:
source: './hiprt ./test'
exclude: './contrib ./tools ./scripts'
extensions: 'h,cpp,c'
clangFormatVersion: 15
inplace: 'True'
# Step 2: Update commit hash in version.txt (line 4)
- name: Update version.txt with latest commit hash
run: |
FILE="version.txt"
HASH=$(git rev-parse --short HEAD)
if [ -f "$FILE" ]; then
echo "Updating $FILE with hash $HASH"
sed -i "4s~.*~$HASH~" "$FILE"
else
echo "File $FILE not found!"
exit 1
fi
# Step 3: Commit and push all changes (format + hash)
- name: Commit and push changes
uses: EndBug/add-and-commit@v9.1.1
with:
author_name: rprbuild
author_email: a1rpr@amd.com
message: 'Automatic: clang-format + hash update'