rtCamp / action-deploy-wordpress

GitHub Action for deploying a WordPress site using using PHP's Deployer.org

Home Page:https://github.com/rtCamp/github-actions-library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Checkout Action failing on self-hosted runner due to permission issue

dhsathiya opened this issue · comments

Error

Initializing the repository
  /usr/bin/git init /home/actions/actions-runner/_work/example/example
  /home/actions/actions-runner/_work/example/example/.git: Permission denied
  Error: The process '/usr/bin/git' failed with exit code 1

Reason

main.sh-L143 is setting up $GITHUB_WORKSPACE directory owner to root.

Cleanup action is cleaning up properly, but the directory permission stays at it is.

This creates a permission issue while running git init.

╭─root@dhsathiya-temp ~/actions/actions-runner/_work/example/example  
╰─➤  l
drwxrwxr-x 2 root    root    4.0K May 29 21:04 .
drwxrwxr-x 3 actions actions 4.0K May 29 19:30 ..

Fix

Applying another chown on the $GITHUB_WORKSPACE with user action

╭─root@dhsathiya-temp ~/actions/actions-runner/_work/example/example  
╰─➤  l
drwxrwxr-x  7 actions actions 4.0K May 29 21:16 .
drwxrwxr-x  3 actions actions 4.0K May 29 21:16 ..

Requires to cleanup ~/actions/actions-runner/_work/ directory manually

In the fix #39, the applied chown is being run on submodule install step. But there is another git clone step even after that function, which could fail in case of VIP site deployment due to this change in ownership.

Ideally making file changes and updating ownership in favour of the action should be handled by the action, but the reversals, like fixing ownership and bringing things back to clean state should be the job of cleanup action.