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

[BUG] warnUnsupportedRESTAPIInputs failing with composite action & use_rest_api #1865

Closed
4 tasks done
drewfradette opened this issue Jan 16, 2024 · 0 comments · Fixed by #1866
Closed
4 tasks done
Labels
bug Something isn't working

Comments

@drewfradette
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Does this issue exist in the latest version?

  • I'm using the latest release

Describe the bug?

The changes in #1853 seem to prevent tj-actions/changed-files from being used within a composite action while using the new inputs.use_rest_api: true.

Initial Error

 Error: EISDIR: illegal operation on a directory, read

This is due to the readFile(actionPath) in warnUnsupportedRESTAPIInputs using env.GITHUB_ACTION_PATH. This variable points to a directory, not a file.

Adding path.join(actionPath, "action.yml") around here will resolve the EISDIR from throwing an error.

Followup Error

Error: Cannot read properties of undefined (reading 'sha')

Unfortunately, once I resolved the above error, warnUnsupportedRESTAPIInputs still fails to run successfully.

This is due to the contents of ${GITHUB_ACTION_PATH}/action.yml being the composite action's yaml and not the one associated with tj-actions/changed-files. This means there are no inputs and default cannot be pulled.

To Reproduce

This composite action, when invoked from a workflow, will cause the issue.

# .github/actions/repro/action.yml
name: Repro
description: 'Repro composite action'

runs:
  using: composite
  steps:
    - uses: tj-actions/changed-files@v41
      id: changed-files
      with:
        use_rest_api: true
    - name: Other steps that use changed-files
      shell: bash
      run: echo -e "${{ steps.changed-files.outputs.all_changed_and_modified_files }}"
# .github/workflows/sample.yml
name: Sample Workflow

on:
  workflow_dispatch: {}

jobs:
  sample:
    runs-on: ubuntu-22.04
    permissions:
      contents: read
      pull-requests: read
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/actions/repro

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-22.04

Expected behavior?

tj-actions/changed-files can be used in a composite action with inputs.use_rest_api: true.

Relevant log output

Relevant logs shown above in the bug description.

Has all relevant logs been included?

  • I've included all relevant logs

Anything else?

Sorry this is a bug and not a PR! I was all set to send a fix for the EISDIR error but the followup error doesn't have a clear fix as a non-maintainer. Figured an issue would be easier.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@drewfradette drewfradette added the bug Something isn't working label Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant