-
Notifications
You must be signed in to change notification settings - Fork 18
Update collections docs for latest cli #730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -278,28 +278,74 @@ fn(state => { | |
|
|
||
| ## CLI usage | ||
|
|
||
| Workflows which use Collections can be run through the CLI. You will need to: | ||
| Since version 1.21.0 (Jan 2026), `@openfn/cli` fully supports the use of | ||
| collections in workflows. | ||
|
|
||
| - Get a Personal Access Token (PAT) | ||
| - Update the `workflow.json` with your PAT and the OpenFn endpoint | ||
| - Set the step to use the Collections adaptor | ||
| Prior to 1.21.0, special setup was needed. So this guide is split into two | ||
| sections: we recommend using the latest CLI and following first guide below. | ||
| It's shorter, cleaner and easier. | ||
|
|
||
| But if you're unable to update your CLI, you can still configure collections | ||
| manually with the [Older CLI guide](#older-cli). | ||
|
|
||
| Remember that a Collection must be created from the Admin page before it can be | ||
| used! | ||
|
|
||
| :::tip | ||
|
|
||
| You can also call the Collections API directly from the CLI, without using a | ||
| Workflow. See the [CLI Collections Guide](/documentation/collections-cli) | ||
|
|
||
| ::: | ||
|
|
||
| ### Latest CLI 1.20+ | ||
|
|
||
| The CLI includes full native support for collections within a workflow. | ||
|
|
||
| If you've pulled a project from the app (Lightning), all you'll need to do is | ||
| provide an API Token when you run the workflow. You can either do this by | ||
| passing the `--api-key` argument, or by setting the `OPENFN_API_KEY` env var. | ||
|
|
||
| ```bash | ||
| openfn my-workflow.json --api-key $MY_OPENFN_PAT | ||
| ``` | ||
|
|
||
| By default, the CLI will use our cloud platform at app.openfn.org to find any | ||
| collections referenced in the workflow. To use a different deployment server, | ||
| you can pass `--endpoint` or set the `OPENFN_ENDPOINT` env var. Note that this | ||
| should point to the server root - so `http://app.openfn.org`, not | ||
| `http://app.openfn.org/collections`. | ||
|
|
||
| :::tip | ||
|
|
||
| You can also call the Collections API directly from the CLI. See the | ||
| [CLI Collections Guide](/documentation/collections-cli) | ||
| Since v1.19.0 The CLI fully supports `.env` files. If you run multiple projects | ||
| locally, you may want to create a `.env` file in your project root and configure | ||
| your endpoint and API token in there: | ||
|
|
||
| ``` | ||
| OPENFN_API_KEY="eyJhbGc..." | ||
| OPENFN_ENDPOINT="https://app.openfn.org" | ||
| ``` | ||
|
|
||
| The `.env` file will be automatically loaded by the CLI. Check debug output for | ||
| details. | ||
|
|
||
| ::: | ||
|
|
||
| Collections are designed for close integration with the platform app, but can be | ||
| used from the CLI too. | ||
| ### Older CLI | ||
|
|
||
| The rest of this guide only applies when using older CLI versions. | ||
|
|
||
| You can get a Personal Access Token from any v2 deployment. | ||
| If you're using a version prior to 1.21.0, you will need to: | ||
|
|
||
| - Get a Personal Access Token (PAT) | ||
| - Update the `workflow.json` with your PAT and the OpenFn endpoint | ||
mtuchi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Update the step in the workflow to use the Collections adaptor | ||
mtuchi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Remember that a Collection must be created from the Admin page before it can be | ||
|
||
| used! | ||
|
|
||
| ### For a single job | ||
| #### For a single job | ||
|
|
||
| You can pass multiple adaptors from the CLI: | ||
|
|
||
|
|
@@ -318,7 +364,7 @@ You'll need to set configuration on the state.json: | |
| } | ||
| ``` | ||
|
|
||
| ### For a workflow | ||
| #### For a workflow | ||
|
|
||
| If you're using `workflow.json`, set the token and endpoint on | ||
| `workflow.credentials`: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrong key, this should be |
||
|
|
@@ -350,8 +396,12 @@ And make sure that any steps which use collections have multiple adaptors set: | |
| } | ||
| ``` | ||
|
|
||
| ### I've noticed a problem with this Adaptor, or something is out of date, what can I do? | ||
| ## Contributing | ||
|
|
||
| Thanks for asking! We are a fully Open Source Digital Public Good, and we welcome contributions from our community. Check out our [Adaptors Wiki](https://github.com/OpenFn/adaptors/blob/main/wiki/index.md) for more information on how you can update Adaptors! | ||
| We are a fully Open Source Digital Public Good, and we welcome contributions | ||
| from our community. Check out our | ||
| [Adaptors Wiki](https://github.com/OpenFn/adaptors/blob/main/wiki/index.md) for | ||
| more information on how you can update Adaptors! | ||
|
|
||
| Or, you can always reach out to the Community through our [Community Forum here](https://community.openfn.org/). | ||
| Or, you can always reach out to the Community through our | ||
| [Community Forum here](https://community.openfn.org/). | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @josephjclark hate to be picky 😬 but, any user can create collections from project settings page now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah great catch, thanks!