Editing jobs locally
To edit jobs, instead of using the OpenFn Job Studio you can also use your favorite text editor and make changes offline, committing and pushing to GitHub to deploy to your OpenFn using the version control feature.
First, make sure that version control is set up for your project and the job in question. When that's all done, follow the steps below:
Make sure you have git installed
Clone the repo from GitHub. Depending on how you're connecting, grab the HTTPS or SSH URL of the repository.
You can connect to GitHub with username+password (HTTPS) or an SSH keypair you generated. (You can check out the GitHub docs for more info.)
Then use it to clone the repo to your computer by running this command in a folder that you'd like to contain your new repo:
git clone {repo URL}
(e.g.,git clone https://github.com/OpenFn/Miracle-Feet.git
)To update your local copy with changes from GitHub, run
git pull
regularly while you're editing.For this tutorial, we assume you're making changes on the
main
ormaster
branch: the one that is deployed as your production system to OpenFn.To edit your jobs, use a code editor such as Visual Studio Code.
- Make sure you install the Prettier VSCode Extension and set is as default formatter in Settings as seen below. This will apply the correct code formatting to the files you change.
Once you're done, you can check which files you changed with
git status
.Then use
git add {filepath}
followed bygit commit -m {change notes}
to prepare the changes to be merged into the repo.
There's a lot to learn about git. Here's a good place to start.
- Then run
git push
to upload the files to the repo (see more on git docs).
From there, the version control integration will update changed jobs in your OpenFn project and you can test those changes on the platform.
Once you're ready to start running jobs and testing your changes locally, head over to the The CLI docs for guidance.