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
82 changes: 82 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"permissions": {
"allow": [
"Read",
"Glob",
"Grep",
"Edit",
"Write",
"NotebookEdit",
"WebFetch",
"WebSearch",

"Bash(git status*)",
"Bash(git diff*)",
"Bash(git log*)",
"Bash(git show*)",
"Bash(git branch*)",
"Bash(git fetch*)",
"Bash(git rebase*)",
"Bash(git apply*)",
"Bash(git worktree*)",
"Bash(git show-branch*)",
"Bash(git tag*)",
"Bash(git stash*)",
"Bash(git checkout*)",
"Bash(git add*)",
"Bash(git commit*)",
"Bash(git rev-parse*)",
"Bash(git merge-base*)",
"Bash(gh *)",

"Bash(./setup_workspace.sh*)",
"Bash(./apply_patches.sh*)",
"Bash(./build_all.sh*)",
"Bash(make *)",

"Bash(./scripts/deploy_kernel*)",
"Bash(ssh *)",
"Bash(scp *)",

"Bash(python3 *)",
"Bash(pytest *)",
"Bash(python3 test/*)",

"Bash(cppcheck *)",

"Bash(ls *)",
"Bash(find *)",
"Bash(grep *)",
"Bash(cat *)",
"Bash(head *)",
"Bash(tail *)",
"Bash(wc *)",
"Bash(diff *)",
"Bash(file *)",
"Bash(realpath *)",
"Bash(nproc*)",
"Bash(which *)",
"Bash(tee *)",
"Bash(mkdir *)",
"Bash(cp *)",
"Bash(mv *)",
"Bash(ln *)",
"Bash(tar *)",
"Bash(wget *)",
"Bash(curl *)",

"Bash(v4l2-ctl *)",
"Bash(media-ctl *)",
"Bash(lsmod*)",
"Bash(dmesg*)",
"Bash(sudo dmesg*)",
"Bash(uname *)"
],
"deny": [
"Bash(git push --force*)",
"Bash(git reset --hard*)",
"Bash(git clean -f*)",
"Bash(rm -rf /*)"
]
}
}
143 changes: 143 additions & 0 deletions .github/workflows/auto-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: Auto-Tag Daily Version Bump

on:
schedule:
- cron: '0 14 * * *'
workflow_dispatch:

Copilot AI Feb 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow can run on both schedule and workflow_dispatch, but there is no concurrency guard. Overlapping runs can race (both compute the same next version/tag) and cause push/tag failures or inconsistent bumps. Add workflow/job-level concurrency (e.g., grouped by workflow name + dev) to ensure only one bump runs at a time.

Suggested change
concurrency:
group: auto-tag-dev
cancel-in-progress: false

Copilot uses AI. Check for mistakes.
permissions:
contents: write

jobs:
bump-version:
runs-on: ubuntu-latest

steps:
- name: Checkout dev
uses: actions/checkout@v4
Comment on lines +15 to +17

Copilot AI Feb 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

steps: is not followed by an indented YAML sequence. In GitHub Actions, list items under steps must be indented further than the steps: key (e.g., steps: then - name: ...). As written, this workflow file is invalid YAML and will fail to load.

Copilot uses AI. Check for mistakes.
with:
ref: dev
fetch-depth: 0

- name: Branch guard
run: |
branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$branch" != "dev" ]; then
echo "::error::Expected branch 'dev', got '$branch'"
exit 1
fi

- name: Find latest tag
id: latest_tag
run: |
tag=$(git tag --merged HEAD --sort=-v:refname | grep -E '^v[0-9]+\.' | head -1)
if [ -z "$tag" ]; then
echo "::error::No version tags found on dev. Create an initial tag manually (e.g., git tag -a v1.0.2.10 -m 'Initial tag')."
exit 1
fi
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "Found latest tag: $tag"

- name: Check for meaningful changes
id: changes
run: |
tag="${{ steps.latest_tag.outputs.tag }}"
changed=$(git diff --name-only "$tag"..HEAD)

if [ -z "$changed" ]; then
echo "No changes since $tag"
echo "has_changes=false" >> "$GITHUB_OUTPUT"
exit 0
fi

# Filter out ignored paths
meaningful=$(echo "$changed" | grep -v -E '^(\.claude/|\.github/|test/|docs/)' || true)

if [ -z "$meaningful" ]; then
echo "Only ignored-folder changes since $tag:"
echo "$changed"
echo "has_changes=false" >> "$GITHUB_OUTPUT"
else
echo "Meaningful changes since $tag:"
echo "$meaningful"
echo "has_changes=true" >> "$GITHUB_OUTPUT"
fi

- name: Parse current version
if: steps.changes.outputs.has_changes == 'true'
id: version
run: |
current=$(grep -oP 'MODULE_VERSION\("\K[^"]+' kernel/realsense/d4xx.c)
if [ -z "$current" ]; then
echo "::error::Could not parse MODULE_VERSION from d4xx.c"
exit 1
fi
echo "current=$current" >> "$GITHUB_OUTPUT"
echo "Current version: $current"

- name: Increment build number
if: steps.changes.outputs.has_changes == 'true'
id: bump
run: |
current="${{ steps.version.outputs.current }}"
IFS='.' read -r major minor patch build <<< "$current"
new_build=$((build + 1))
Comment on lines +83 to +84

Copilot AI Feb 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build-number bump assumes MODULE_VERSION always has exactly 4 dot-separated numeric components. If build is empty/non-numeric (or has leading zeros like 09), the bash arithmetic will fail or behave unexpectedly. Add validation (regex) and use base-10 arithmetic (e.g., new_build=$((10#$build + 1))) with a clear error if the version format is unsupported.

Suggested change
IFS='.' read -r major minor patch build <<< "$current"
new_build=$((build + 1))
if [[ ! "$current" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
echo "::error::Unsupported MODULE_VERSION format '$current'. Expected 'X.Y.Z.BUILD' with numeric components."
exit 1
fi
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
patch="${BASH_REMATCH[3]}"
build="${BASH_REMATCH[4]}"
new_build=$((10#$build + 1))

Copilot uses AI. Check for mistakes.
new_version="${major}.${minor}.${patch}.${new_build}"
echo "new_version=$new_version" >> "$GITHUB_OUTPUT"
echo "new_tag=v${new_version}" >> "$GITHUB_OUTPUT"
echo "Bumping: $current -> $new_version"

- name: Update d4xx.c
if: steps.changes.outputs.has_changes == 'true'
run: |
current="${{ steps.version.outputs.current }}"
new_version="${{ steps.bump.outputs.new_version }}"
sed -i "s/MODULE_VERSION(\"${current}\")/MODULE_VERSION(\"${new_version}\")/" kernel/realsense/d4xx.c

# Verify the update
updated=$(grep -oP 'MODULE_VERSION\("\K[^"]+' kernel/realsense/d4xx.c)
if [ "$updated" != "$new_version" ]; then
echo "::error::VERSION update failed. Expected '$new_version', got '$updated'"
exit 1
fi
echo "d4xx.c updated to $new_version"

- name: Commit and tag
if: steps.changes.outputs.has_changes == 'true'
run: |
new_version="${{ steps.bump.outputs.new_version }}"
new_tag="${{ steps.bump.outputs.new_tag }}"

git config user.email "builder@example.com"
git config user.name "builder"
git add kernel/realsense/d4xx.c
git commit -m "Bump version to ${new_version}"
git tag -a "$new_tag" -m "Version ${new_version}"

- name: Push commit
if: steps.changes.outputs.has_changes == 'true'
run: git push origin dev

- name: Push tag
if: steps.changes.outputs.has_changes == 'true'
run: git push origin "${{ steps.bump.outputs.new_tag }}"

Comment on lines +117 to +124

Copilot AI Feb 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit and tag are pushed in separate steps. If the commit push succeeds but the tag push fails, dev is bumped without a corresponding tag and reruns can keep bumping again. Consider pushing commit+tag together (e.g., git push --follow-tags) and failing the job if either ref can鈥檛 be pushed.

Suggested change
- name: Push commit
if: steps.changes.outputs.has_changes == 'true'
run: git push origin dev
- name: Push tag
if: steps.changes.outputs.has_changes == 'true'
run: git push origin "${{ steps.bump.outputs.new_tag }}"
- name: Push commit and tag
if: steps.changes.outputs.has_changes == 'true'
run: git push --follow-tags origin dev

Copilot uses AI. Check for mistakes.
- name: Summary
run: |
if [ "${{ steps.changes.outputs.has_changes }}" == "true" ]; then
cat >> "$GITHUB_STEP_SUMMARY" <<EOF
## Version Bump Completed

| | |
|---|---|
| **Previous tag** | \`${{ steps.latest_tag.outputs.tag }}\` |
| **New version** | \`${{ steps.bump.outputs.new_version }}\` |
| **New tag** | \`${{ steps.bump.outputs.new_tag }}\` |
EOF
else
cat >> "$GITHUB_STEP_SUMMARY" <<EOF
## No Version Bump Needed

No meaningful changes since \`${{ steps.latest_tag.outputs.tag }}\`. Skipped.
EOF
fi