tighten/duster

GitHub Actions: Rector Binary Not Found in Workflow

Closed this issue · 2 comments

I have Rector already included in my project and configured it in the duster.json file as follows:

{
    "scripts": {
        "lint": {
            "rector": ["./vendor/bin/rector", "--dry-run"]
        },
        "fix": {
            "rector": ["./vendor/bin/rector"]
        }
    },
    "processTimeout": 120
}

Everything works perfectly in my local environment. However, when running this setup in my GitHub Actions workflow, Rector fails to execute with the following error:

sh: exec: line 0: ./vendor/bin/rector: not found

Even though Rector is installed, it seems that GitHub Actions cannot locate the binary. Below is my workflow file for reference:

name: Duster Fix

# Commits made in here will not trigger any workflows
# Checkout Duster's documentation for a workaround

on:
    push:
        branches: [main]
    pull_request:

jobs:
    duster:
        runs-on: ubuntu-latest

        permissions:
            contents: write

        steps:
            - uses: actions/checkout@v4
              with:
                  ref: ${{ github.event.pull_request.head.ref }}
                  repository: ${{ github.event.pull_request.head.repo.full_name }}

            - name: 'Duster Fix'
              uses: tighten/duster-action@v3
              with:
                  args: fix

            - uses: stefanzweifel/git-auto-commit-action@v5
              id: auto_commit_action
              with:
                  commit_message: Dusting
                  commit_user_name: GitHub Action
                  commit_user_email: actions@github.com

            - name: Ignore Duster commit in git blame
              if: steps.auto_commit_action.outputs.changes_detected == 'true'
              run: echo ${{ steps.auto_commit_action.outputs.commit_hash }} >> .git-blame-ignore-revs

            - uses: stefanzweifel/git-auto-commit-action@v5
              with:
                  commit_message: Ignore Dusting commit in git blame
                  commit_user_name: GitHub Action
                  commit_user_email: actions@github.com

I would appreciate any assistance in resolving this issue. Thank you!

You may need to update the workflow to install all your dependencies.
See #148 for a similar issue.

The issue has been resolved. It was the same problem as #148.

Thank you!