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

Specify directory to run audit on #194

Open
1 of 3 tasks
kennetpostigo opened this issue May 23, 2021 · 6 comments
Open
1 of 3 tasks

Specify directory to run audit on #194

kennetpostigo opened this issue May 23, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@kennetpostigo
Copy link

Do the checklist before filing an issue:

Motivation

My rust/cargo project isn't at the top level of my repo, so my audit check always fails because it can't find my Cargo.toml/Cargo.lock file and it doesn't take a manifest-path like other cargo commands do.

Describe your idea, motivation, and how Rust community could benefit from this feature.

Workflow example

It would be awesome if the action would read working-directory or take a manifest-path arg

jobs:
  security_audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions-rs/audit-check@v1
        with:
          # consume working-directory
          working-directory: api
          # or read args
          args: --manifest-path api/Cargo.lock
          token: ${{ secrets.GITHUB_TOKEN }}

Additional context

I've tried a couple work arounds but couldn't get any of them working, I hope this isn't an invasive/difficult addition.

@kennetpostigo kennetpostigo added the enhancement New feature or request label May 23, 2021
@martin-g
Copy link

martin-g commented Jul 8, 2021

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
Copy link

martin-g commented Jul 8, 2021

It seems this issue is a duplicate of #116

@fzyzcjy
Copy link

fzyzcjy commented Oct 4, 2021

any updates?

@stefangalowicz
Copy link

I'm also interested in this, since we're using a mono repository.

This is a general problem with GitHub actions, because the defaults: run: working-directory setting is not inherited by actions that are invoked with uses:, but only steps that use run: instead.
Therefore every action solves this in its own way.

audit-check is not consistent with actions-rs/clippy-check here by the way, which allows passing with: args: .

@MariusVB
Copy link

I'm also interested in this but have found a temporary solution. Just replace {CARGO_SUBDIR} with your cargo project directory in your repo and {DIRS_TO_REMOVE} with all the non-cargo directories in the top-level of your repo:

jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      # Moves all files in sub dir to top-level dir
      - run: cd $GITHUB_WORKSPACE && mv {CARGO_SUBDIR}/* .
      # Delete directories not to be audited
      - run: cd $GITHUB_WORKSPACE && rm -rf {DIRS_TO_REMOVE}
      - uses: actions-rs/audit-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

@nicolaspernoud
Copy link

+1 the workaround works, but is cumbersome...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Development

No branches or pull requests

6 participants