Skip to content

feat: specify current_working_directory where to run your scripts from#131

Merged
levibostian merged 5 commits intomainfrom
run-in-subdirectory
Jan 25, 2026
Merged

feat: specify current_working_directory where to run your scripts from#131
levibostian merged 5 commits intomainfrom
run-in-subdirectory

Conversation

@levibostian
Copy link
Copy Markdown
Owner

Related GitHub Issues

Problem

This is a feature that is mostly intended for people who want to separate their deployment code from their application code and be able to use dependencies, a package manager, or whatever language they want. Everything is encapsulated in a directory.

Solution

The solution is that you can change the working directory that Decaf is running from, which then allows package managers, for example, to reference their files in that directory, like the package.json or deno.json file.

You do have to make sure to change your directory to go back to the parent directory where your code probably exists. But hey, at least this is a nice little feature for you.

Testing

  • Added automated tests.
  • Manually tested. If you check this box, provide instructions for others to test, too.

Testing the feature in this pull request by using it in our CI setup.

Notes for reviewers

The biggest reason for wanting this feature is if you want to separate your deployment scripts from your main application code. This way, you can use a package manager for dependencies and such. It's kind of like fully encapsulating your deployment scripts.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 22, 2026

decaf

Running deployments in test mode. Results will appear below.
If this pull request and all of it's parent pull requests are merged using the...

...🟩 squash 🟩 merge method... 🚢 The next version of the project will be: 0.11.0

Learn more
Latest release: 0.10.0
Commit of latest release: 8c5744c

Commits since last release:
- feat: specify current_working_directory where to run your scripts from

Related GitHub Issues

Problem

This is a feature that is mostly intended for people who want to separate their deployment code from their application code and be able to use dependencies, a package manager, or whatever language they want. Everything is encapsulated in a directory.

Solution

The solution is that you can change the working directory that Decaf is running from, which then allows package managers, for example, to reference their files in that directory, like the package.json or deno.json file.

You do have to make sure to change your directory to go back to the parent directory where your code probably exists. But hey, at least this is a nice little feature for you.

Testing

  • Added automated tests.
  • Manually tested. If you check this box, provide instructions for others to test, too.

Testing the feature in this pull request by using it in our CI setup.

Notes for reviewers

...🟩 rebase 🟩 merge method... 🚢 The next version of the project will be: 0.11.0

Learn more
Latest release: 0.10.0
Commit of latest release: 8c5744c

Commits since last release:
- build: run deploy script tests separate from the main codebase tests

why?

  • As a way to demonstrate the new current_working_directory feature where we can separate codebase and deploy scripts.
  • The code coverage currently includes these user scripts, but I don't think it should anymore.
    - feat: add DECAF_ROOT_WORKING_DIRECTORY env var for step scripts

Automatically pass git repository root path to all step scripts via
DECAF_ROOT_WORKING_DIRECTORY environment variable. Refactored
StepRunnerImpl constructor to object parameters to support this.

  • Step scripts can now access git root via $DECAF_ROOT_WORKING_DIRECTORY
  • Works seamlessly with current_working_directory configuration
  • Updated example scripts (deploy.ts, get-latest-release.ts)
  • All 285 tests passing
    - ci: modify this project's circleci to use current_working_directory

to try out the changes made in commit 24ab01e
similar change to fb66ebb where I did it with github actions
- ci: modify this project's github actions to use current_working_directory

to try out the changes made in commit 24ab01e
- feat: specify current_working_directory where to run your scripts from

The biggest reason for wanting this feature is if you want to separate your deployment scripts from your main application code. This way, you can use a package manager for dependencies and such. It's kind of like fully encapsulating your deployment scripts.

to try out the changes made in commit 24ab01e
similar change to fb66ebb where I did it with github actions
levibostian added a commit to levibostian/decaf-sdk-deno that referenced this pull request Jan 23, 2026
…in testing module (#9)

[a new config option is being added to
decaf](levibostian/decaf#131):
current_working_directory. This is to add support for that new feature.

## Related GitHub Issues
<!-- Link to any related GitHub issues that this pull request addresses
or closes. -->

## Problem
<!-- A clear description of the problem that this pull request is
solving. -->

## Solution
<!-- Describe the approach you took to solve the problem and the changes
made in this pull request. -->

## Testing
<!-- Choose one of the below options for how you tested the code change.
Include any specific setup or instructions for testing. -->
- [X] Added automated tests. 
- [X] Manually tested. If you check this box, provide instructions for
others to test, too.

I bundled the testing/mod.ts file and tested it works in the decaf PR
tests.

## Notes for reviewers 
<!-- If there is any additional information you would like to share with
the person reviewing this pull request, please provide it here. -->
@coveralls
Copy link
Copy Markdown

coveralls commented Jan 24, 2026

Pull Request Test Coverage Report for Build 21333293329

Details

  • 61 of 61 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 81.519%

Totals Coverage Status
Change from base Build 21144387508: -0.1%
Covered Lines: 1294
Relevant Lines: 1623

💛 - Coveralls

levibostian added a commit to levibostian/decaf-sdk-deno that referenced this pull request Jan 24, 2026
…does (#10)

## Related GitHub Issues
<!-- Link to any related GitHub issues that this pull request addresses
or closes. -->

## Problem
<!-- A clear description of the problem that this pull request is
solving. -->

[in v0.11.0, decaf will be adding DECAF_ROOT_WORKING_DIRECTORY env
variable as a convenience to accompany
`current_working_directory`](levibostian/decaf#131).
We need to update the SDK to also add this var in order for you to use
that var in your script.

## Solution
<!-- Describe the approach you took to solve the problem and the changes
made in this pull request. -->

Set it, just like decaf does. 

## Testing
<!-- Choose one of the below options for how you tested the code change.
Include any specific setup or instructions for testing. -->
- [X] Added automated tests. 
- [X] Manually tested. If you check this box, provide instructions for
others to test, too.

I bundled the testing module, then ran it in the decaf test suite and
proved that it works.

## Notes for reviewers 
<!-- If there is any additional information you would like to share with
the person reviewing this pull request, please provide it here. -->
Automatically pass git repository root path to all step scripts via
DECAF_ROOT_WORKING_DIRECTORY environment variable. Refactored
StepRunnerImpl constructor to object parameters to support this.

- Step scripts can now access git root via $DECAF_ROOT_WORKING_DIRECTORY
- Works seamlessly with current_working_directory configuration
- Updated example scripts (deploy.ts, get-latest-release.ts)
- All 285 tests passing
why?
- As a way to demonstrate the new `current_working_directory` feature where we can separate codebase and deploy scripts.
- The code coverage currently includes these user scripts, but I don't think it should anymore.
@levibostian levibostian marked this pull request as ready for review January 25, 2026 13:22
@levibostian levibostian merged commit 88b0205 into main Jan 25, 2026
12 checks passed
@levibostian levibostian deleted the run-in-subdirectory branch January 25, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants