@actions/exec seems to ignore working-directory workflow setting
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
In an action configured with a working-directory setting, the default CWD of exec.exec() seems to ignore that setting.
To Reproduce
Create a workflow like this:
name: "Docker: Build & Test"
on: [push] # irrelevant
jobs:
build:
name: Build Docker image
runs-on: ubuntu-latest
defaults:
run:
working-directory: mydir # this bit
steps:
- uses: some/action
in a repository with some files in mydir at the root
And an action containing this:
import * as exec from '@actions/exec'
async function run(): Promise<void> {
await exec.exec('pwd')
await exec.exec('ls')
}
run()
Expected behavior
The pwd output should reflect the working-directory setting. The ls output should show the contents of that directory.
Additional context
Both the workflow-level and job-level working-directory setting are ignored. It's not clear how to get at that value to set it manually, if it's even possible.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided workflow and the TypeScript calls to @actions/exec.exec('pwd') and exec('ls'), then inspect how the execution context is established. Confirm whether workflow- and job-level working-directory values are available to an action, and document or implement behavior that matches the expected directory output if the toolkit can access them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, typescript
- Domain
- devops, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100