Fix Git hooks ownership in devcontainer setup #56

Merged
Philipp merged 1 commits from fix-hook-install into main 2025-12-31 18:55:46 +01:00
Owner

PR Type

Bug fix


Description

  • Fix .git/hooks ownership in devcontainer setup

  • Ensure pre-commit hooks install correctly


Diagram Walkthrough

flowchart LR
  A["chown .cache directory"] --> B["chown .git/hooks directory"]
  B --> C["pre-commit install commands"]

File Walkthrough

Relevant files
Configuration changes
setup.sh
Add ownership fix for `.git/hooks`                                             

.devcontainer/setup.sh

  • Added sudo chown -R node:node .git/hooks before hook install
+1/-1     

### **PR Type** Bug fix ___ ### **Description** - Fix `.git/hooks` ownership in devcontainer setup - Ensure pre-commit hooks install correctly ___ ### Diagram Walkthrough ```mermaid flowchart LR A["chown .cache directory"] --> B["chown .git/hooks directory"] B --> C["pre-commit install commands"] ``` <details> <summary><h3> File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Configuration changes</strong></td><td><table> <tr> <td> <details> <summary><strong>setup.sh</strong><dd><code>Add ownership fix for `.git/hooks`</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> .devcontainer/setup.sh - Added `sudo chown -R node:node .git/hooks` before hook install </details> </td> <td><a href="https://git.horstenkamp.eu/Screeps/screeps-deploy-action/src/branch/fix-hook-install/.devcontainer/setup.sh">+1/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> </details> ___
Philipp added 1 commit 2025-12-31 18:54:33 +01:00
fix: pre-commit hooks should now be installable in dev containers
All checks were successful
Lint / pre-commit Linting (push) Successful in 48s
7506643773
Philipp scheduled this pull request to auto merge when all checks succeed 2025-12-31 18:54:45 +01:00
AutoReview changed title from fix: pre-commit hooks should now be installable in dev containers to Fix Git hooks ownership in devcontainer setup 2025-12-31 18:54:54 +01:00
Member

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵
🧪 No relevant tests
🔒 No security concerns identified
 Recommended focus areas for review

Relative path usage

Using a relative path for .git/hooks may lead to incorrect directory targeting if the script is run from a different working directory. Consider using an absolute path or ensuring the script’s working directory is the repo root.

sudo chown -R node:node .git/hooks
Directory existence

The script assumes the .git/hooks directory exists. If .git is not initialized, chown will fail. Add a check to verify the directory before attempting ownership changes.

sudo chown -R node:node .git/hooks
## PR Reviewer Guide 🔍 Here are some key observations to aid the review process: <table> <tr><td>⏱️&nbsp;<strong>Estimated effort to review</strong>: 1 🔵⚪⚪⚪⚪</td></tr> <tr><td>🧪&nbsp;<strong>No relevant tests</strong></td></tr> <tr><td>🔒&nbsp;<strong>No security concerns identified</strong></td></tr> <tr><td>⚡&nbsp;<strong>Recommended focus areas for review</strong><br><br> <details><summary><a href='https://git.horstenkamp.eu/Screeps/screeps-deploy-action/src/branch/fix-hook-install/.devcontainer/setup.sh#L8-L8'><strong>Relative path usage</strong></a> Using a relative path for `.git/hooks` may lead to incorrect directory targeting if the script is run from a different working directory. Consider using an absolute path or ensuring the script’s working directory is the repo root. </summary> ```shell sudo chown -R node:node .git/hooks ``` </details> <details><summary><a href='https://git.horstenkamp.eu/Screeps/screeps-deploy-action/src/branch/fix-hook-install/.devcontainer/setup.sh#L8-L8'><strong>Directory existence</strong></a> The script assumes the `.git/hooks` directory exists. If `.git` is not initialized, `chown` will fail. Add a check to verify the directory before attempting ownership changes. </summary> ```shell sudo chown -R node:node .git/hooks ``` </details> </td></tr> </table>
Member

PR Code Suggestions

## PR Code Suggestions ✨ <!-- -->
Philipp merged commit 3f19a64809 into main 2025-12-31 18:55:46 +01:00
Philipp deleted branch fix-hook-install 2025-12-31 18:55:47 +01:00
Sign in to join this conversation.