Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting vendored_phpcs_path fails with chmod: Operation not permitted #4

Open
td-sclemens opened this issue Nov 12, 2024 · 6 comments

Comments

@td-sclemens
Copy link

I created this action to add basic code sniffing for pull requests:

name: Code Sniffer

on:
  pull_request:

jobs:
  sniff:
    name: Sniff changed files
    runs-on: my-server
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 2

      - name: Cache Composer dependencies
        uses: actions/cache@v4
        with:
          path: /tmp/composer-cache
          key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}

      - name: Install dependencies
        uses: php-actions/composer@v6
        with:
          php_version: 8.2
          memory_limit: -1
          container_workdir: /app/www
          command: install
          args: --ignore-platform-reqs

      - name: Get changed files
        id: changed-files
        run: echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT

      - name: Sniff changed files
        uses: php-actions/phpcs@v1
        with:
          php_version: 8.2
          vendored_phpcs_path: www/vendor/bin/phpcs
          path: ${{ steps.changed-files.outputs.changed_files }}
          standard: NameOfMyStandard

I liked the possibility to define your own phpcs binary, so the version defined in composer.json is used.

But it fails with this error:

chmod: changing permissions of '/home/runner/_work/name-of-my-project/name-of-my-project/www/vendor/bin/phpcs': Operation not permitted
@td-sclemens
Copy link
Author

Also setting multiple files with path fails, as all is put to quotes in the phpcs-action.bash and interpreted as one file with spaces in its name.
It then of course errors with ERROR: The file "file1 file2 file3" does not exist.

@g105b
Copy link
Member

g105b commented Nov 18, 2024

Thanks for reporting this issue. I'm just letting you know I've received it and it's on my radar, but I'm currently a bit snowed under with project work, so it'll be a little while to get around to open source contributions.

@lkm
Copy link
Contributor

lkm commented Dec 20, 2024

I've run into this as well. I believe it can be fixed with !5

@lkm
Copy link
Contributor

lkm commented Jan 21, 2025

any chance you could review and possibly merge !5 @g105b ?

@g105b
Copy link
Member

g105b commented Jan 22, 2025

Hi @lkm ,

Thank you for your contribution. I hope this resolves the issue. Please can you test by using dev-master? If it works, I will also implement this on the other php-actions repositories.

Thanks again.

@lkm
Copy link
Contributor

lkm commented Jan 23, 2025

@g105b Thanks for that. I did some testing and actually tried it properly this time. The original problem was solved. However, there was an assumption that the override was also a PHAR file which doesn't really make sense since the main reason anybody would want to override this is to us the composer supplied phpcs and enable thirdparty packages alongside it. Please see this PR: #6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants