Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Support "working-directory" input #28

Open
mrowqa opened this issue Nov 27, 2019 · 7 comments
Open

Support "working-directory" input #28

mrowqa opened this issue Nov 27, 2019 · 7 comments

Comments

@mrowqa
Copy link

mrowqa commented Nov 27, 2019

The action currently assumes there is exactly one Rust project and it's located in the root of the repo. It would be great to support working-directory such as the one you can use with regular run in a workflow step.

@svartalf
Copy link
Member

I might miss something here, but would not working-directory just work in this case too?

@mrowqa
Copy link
Author

mrowqa commented Nov 28, 2019

When you define a step, you can use either run or uses. You can specify working-directory only if you choose run - and when you look at the documentation, it's mentioned only there. I tried to use it with uses, but unfortunately after applying some ideas I didn't manage to get it working - sometimes it was ignored, sometimes it caused a workflow format error.

@svartalf
Copy link
Member

svartalf commented Dec 9, 2019

Ah, yes, you are right, my mistake. It feels, though, that GitHub should support that on a global level, as re-implementing the same thing each time in every Action feels quite redundant.

Maybe it worth to file an issue to GitHub?

@mrowqa
Copy link
Author

mrowqa commented Dec 10, 2019

I see your point. I didn't know where I should file an issue, so I sent an email to [email protected].

@mbStavola
Copy link

It's really unfortunate that Github Actions doesn't support working-dir in a use context, huge oversight! Hopefully they can address it soon.

While they work on that though, for anyone who is having trouble using this Action because of that limitation, this might help:

clippy:
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v1
    - run: rustup component add clippy
    - uses: actions-rs/clippy-check@v1
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        args: --all-features --manifest-path path/to/Cargo.toml

--manifest-path allows you to essentially set the working dir of the crate, since it seems like the Clippy action runs relative to wherever the specified Cargo.toml lives.

@dmontagu
Copy link

dmontagu commented Aug 26, 2020

Using the --manifest-path option to specify the Cargo.toml file seems to ensure the action works, but it doesn't seem to get the paths right (they are relative to where Cargo.toml lives, not the repository root), so the feedback can't be viewed from the files view of the PR. (Though they it does appear in the checks list.)

Any suggestions for a workaround?

tgeoghegan added a commit to divviup/prio-server that referenced this issue Apr 23, 2021
We previously were using the
[clippy-check](https://github.com/actions-rs/clippy-check) GitHub Action
to run clippy on changes. There's two problems with this:

 1 - Because our `Cargo.toml` isn't at the root of the repo,
   `clippy-check` can't post clippy results into the PR as comments
   (see #69 and
   actions-rs/clippy-check#28 (comment))
 2 - We recently set `GITHUB_TOKEN` to be readonly at the
   `abetterinternet` level to mitigate potential security problems.
   `clippy-check` requires write permissions to post results.

I'd prefer to keep the `GITHUB_TOKEN` passed to actions readonly, and
since the results wrangling never worked anyway, we can opt out of it.

Now, instead of using the action, we just run `cargo clippy` directly
and fail the build if any warnings are found. Previously `clippy-check`
would just emit findings into the void, never to be seen by anyone.
@qwandor
Copy link

qwandor commented Apr 30, 2021

The problem with the --manifest-path approach is that it doesn't use the .cargo/config under the crate directory. This may be a problem if it specifies a different build.target than the default, e.g. for embedded software that only builds on a particular architecture.

stefanhp pushed a commit to noveto-com/actions-rs-clippy-check that referenced this issue Nov 25, 2022
…and_yarn/eslint-8.17.0

Bump eslint from 8.16.0 to 8.17.0
miguelff added a commit to prisma/prisma-engines that referenced this issue Apr 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

5 participants