dorny / paths-filter

Conditionally run actions based on files modified by PR, feature branch or pushed commits
MIT License
2.14k stars 239 forks source link

No changed files are being detected #173

Closed xcskier56 closed 1 year ago

xcskier56 commented 1 year ago

Hi, I'm really excited about this gem b/c we've been using a home-rolled solution that isn't great. However, I cannot for the life of me get this to recognize that any files have changed.

This workflow is being run when a PR is is opened or a new commit is added to the PR. I have tried

  1. Adding permissions to the workflow per the docs
  2. Adding a base branch even though the docs seem to say that this is ignored for PR workflows
  3. Globbing everything "*"
  4. The "Workflow Permissions" are set to "Read and write" in settings

What am I doing wrong? Thanks

Here is my workflow file

---
  name: workflow

  on:
    push:
      branches: [master]
    pull_request:
      branches: [master]

  jobs:
    rspec:
      name: Rspec - Vessel Platform
      runs-on: ubuntu-latest
      # shared env variables
      env:
        BUNDLE_PATH: vendor/bundle
        ImageOS: ubuntu20 # shouldn't need; trying to work around ruby setup bug
        RAILS_DB_HOST: localhost # This is the host that Rails uses to connect to PG
        RAILS_DB_USER: postgres
        RAILS_DB_PWD: WindyPiglet
        RAILS_DB_NAME: name
        PGHOST: localhost # This is the host that Rails uses to connect to PG
        PGDATABASE: postgres # matches POSTGRES_DB
        PGPASSWORD: WindyPiglet # matches POSTGRES_PASSWORD
        PGUSER: postgres # matches POSTGRES_USER
        # And, of course
        RAILS_ENV: test

      steps:
        - uses: actions/checkout@v3
        - uses: dorny/paths-filter@v2
          id: changed_files
          with:
            base: master # trying even though docs say it will be ignored
            list-files: json
            filters: |
              src:
                - './engines/vp_survey/**'
                - './engines/vp_authn/**'
                - './applications/platform/**'
              app:
                - 'applications/**'
              github:
                - .github/workflows/**
              app2:
                - applications/**
              all:
                - '*'

        - name: Test Changed Files
          run: >-
            echo "Did things change?"
            echo "src: ${{ steps.changed_files.outputs.src }}"
            echo "app: ${{ steps.changed_files.outputs.app }}"
            echo "github: ${{ steps.changed_files.outputs.github }}"
            echo "github changed: ${{ steps.changed_files.outputs.github_files }}"
            echo "app2: ${{ steps.changed_files.outputs.app2 }}"
            echo "all files: ${{ steps.changed_files.outputs.all_files }}"
            echo "changes $${{toJSON(steps.changed_files.outputs.changes)}}"
            echo "files ${{ steps.changed_files.outputs.changed_files }}"

And here is the output of the final step Screen Shot 2022-11-15 at 4 58 55 PM

xcskier56 commented 1 year ago

And... as expected I'm being an idiot 🤦 . This PR only changed the workflow and this issue #146 was a red-herring for me. Sorry for the bother