audit-check icon indicating copy to clipboard operation
audit-check copied to clipboard

Add PROJECT_PATH environment variable

Open S-Coyle opened this issue 5 years ago • 8 comments

Do the checklist before filing an issue:

  • [x] Is this related to the actions-rs Actions? If you think it's a problem related to Github Actions in general, use GitHub Community forum instead: https://github.community
  • [x] You've read the Contributing section about feature requests: https://github.com/actions-rs/.github/blob/master/CONTRIBUTING.md#feature-requests
  • [x] Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.

Motivation

For a variety of reasons, many projects don't contain their Cargo.toml file in their root directory, or they have multiple sub-projects each with their own Cargo.tomls. Would it be possible to make the project path configurable? That way the community would benefit from being able to run from a specified path. We've added this action to a few of our projects and I'm in the process of expanding that to others as it works well, but I've hit this issue which seems to block me from using it in projects such as here ~and only the root directory `Cargo.toml in this repo here~ EDIT: was mistaken about this particular linked repo being an example.

Workflow example

name: Security audit
on:
  schedule:
    - cron: '0 0 * * *'
      
  paths: 
jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions-rs/audit-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
        env:
          PROJECT_PATH: ./my_sub_folder

Additional context

As far as I'm aware there's no way around this at the moment. Been looking for workarounds to this issue I'm facing and found the working-directory option here but turns out it can only be used with run and not with uses. Found a PR here which seems to have resolved this in another action, hoping something similar would work with audit-check.

S-Coyle avatar May 20 '20 14:05 S-Coyle

Same issue here - we use a cargo workspace.

colin-grapl avatar May 26 '20 19:05 colin-grapl

Same -- see also https://github.com/actions-rs/cargo/pull/59

fenollp avatar Sep 24 '20 15:09 fenollp

Same, this would be useful

mortendahl avatar Mar 30 '21 08:03 mortendahl

Related to actions-rs/cargo#86

The best would be if it takes into account the current working directory:

defaults:
  run:
    working-directory: lang/rust

See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaultsrun

martin-g avatar Jul 08 '21 07:07 martin-g

We need this for our monorepo.

See also #194

Ideally, I would suggest letting cargo do the work; it already has a --manifest-path <path/to/Cargo.toml> argument.

In fact, other actions in the actions-rs repo permit this via

with:
  args: --manifest-path mypath/Cargo.toml

jblachly avatar Aug 24 '21 00:08 jblachly

I also hit this particular wall while integrating with my project. Posting to subscribe on further results!

lsunsi avatar Sep 09 '21 14:09 lsunsi

any updates?

fzyzcjy avatar Oct 04 '21 12:10 fzyzcjy

I need this as well. This issue seems to have become stale, but it is quite important. Not every repository has the Rust code / Cargo.toml directly in the repository root.

georglauterbach avatar Dec 04 '21 19:12 georglauterbach