From b54b836cdd9ed3d11e8bfd22299bf5e084cbd7d1 Mon Sep 17 00:00:00 2001 From: Frank Midigo Date: Tue, 13 Oct 2026 16:57:51 +0300 Subject: [PATCH 1/4] v2: deploy openfn.yaml workspaces with openfn project deploy --- README.md | 40 ++++++++++++++++++++++------------------ action.yml | 32 ++++++++++++++++++++++++-------- 2 files changed, 46 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 3539a54..f7742c6 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,37 @@ -#OpenFN Github Deploy Action +# OpenFn GitHub Deploy Action -This action deploys to a specific Lightning instance whenever it is invoked. +Deploys an OpenFn project workspace to Lightning using `openfn project deploy`, +then commits the updated project state back to the branch. -It depends on an repository containing the following +The repository must contain an `openfn.yaml` workspace (as created by +`openfn project pull` or by Lightning's GitHub sync). Commit the `.openfn/` +folder: deploy uses it to detect changes made in Lightning since the last sync. -1. A `state.json` file which details ids and jobs in a project -2. A `project.yaml` file detailing a project its workflows, edges and triggers -3. A `config.json` file detailing a connection to a Lightning instance +> `v1` of this action uses the legacy `config.json` / `openfn deploy` format. +> Pin to `@v1` if your repo still uses it. -Additionally one needs to pass in their OPENFN API KEY to the action as an input best way to do this would be through -an input. The required key is `secret_input` - -See an example project structure [here](https://github.com/OpenFn/dummy-deploy-test) - -An example of how to use this action in workflow -``` +```yaml on: push: branches: - main + workflow_dispatch: + inputs: + force: + type: boolean + default: false jobs: deploy-to-lightning: runs-on: ubuntu-latest - name: Deploy this project to OpenFn/Lightning + permissions: + contents: write steps: - - name: Deploy to Lightning - uses: openfn/deploy-action@v0.1.9 - with: + - name: openfn deploy + uses: openfn/cli-deploy-action@v2 + with: secret_input: ${{ secrets.OPENFN_API_KEY }} + project_id_input: + endpoint_input: https://app.openfn.org + force_input: ${{ inputs.force || false }} ``` - diff --git a/action.yml b/action.yml index b7d5737..56c8eee 100644 --- a/action.yml +++ b/action.yml @@ -2,14 +2,21 @@ name: 'openfn deploy' branding: icon: 'upload' color: 'purple' -description: 'Deploys a yaml file to a Lightning instance' +description: 'Deploys an OpenFn project workspace to a Lightning instance' inputs: secret_input: description: "OpenFN API KEY" required: true - config_path_input: - description: "OpenFN Path to Config" + project_id_input: + description: "OpenFN Project ID to deploy to" required: true + endpoint_input: + description: "Lightning URL, e.g. https://app.openfn.org" + required: true + force_input: + description: "Deploy even if the project has changed in Lightning since the last sync" + required: false + default: 'false' runs: using: "composite" steps: @@ -20,13 +27,22 @@ runs: with: node-version: 24.x - run: | - npm install -g @openfn/cli - openfn deploy -c $OPENFN_CONFIG_PATH --no-confirm + npm install -g @openfn/cli@^1.44.0 + + args=(--endpoint "$OPENFN_DEPLOY_ENDPOINT" --no-confirm) + if [ "$OPENFN_FORCE" = "true" ]; then + args+=(--force) + fi + openfn project deploy "$OPENFN_PROJECT_ID" "${args[@]}" shell: bash - env: + env: OPENFN_API_KEY: ${{ inputs.secret_input }} - OPENFN_CONFIG_PATH: ${{ inputs.config_path_input }} + OPENFN_PROJECT_ID: ${{ inputs.project_id_input }} + OPENFN_DEPLOY_ENDPOINT: ${{ inputs.endpoint_input }} + OPENFN_FORCE: ${{ inputs.force_input }} + # Sync relies on deploy rewriting the checkout files (.openfn/) + OPENFN_NO_CHECKOUT_AFTER_DEPLOY: 'false' - name: Commit updated state file uses: stefanzweifel/git-auto-commit-action@v7 - with: + with: commit_message: Changes accepted by Lightning; updated current project state From 1b372722ff752f19b885e664e84539ba5feea242 Mon Sep 17 00:00:00 2001 From: Frank Midigo Date: Wed, 14 Oct 2026 08:47:34 +0300 Subject: [PATCH 2/4] Make endpoint_input optional --- README.md | 4 ++++ action.yml | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f7742c6..fd07df6 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,10 @@ The repository must contain an `openfn.yaml` workspace (as created by `openfn project pull` or by Lightning's GitHub sync). Commit the `.openfn/` folder: deploy uses it to detect changes made in Lightning since the last sync. +`endpoint_input` is optional. Without it, the CLI uses the endpoint the +workspace already tracks for the project, then `OPENFN_ENDPOINT`, then +app.openfn.org. + > `v1` of this action uses the legacy `config.json` / `openfn deploy` format. > Pin to `@v1` if your repo still uses it. diff --git a/action.yml b/action.yml index 56c8eee..32efb14 100644 --- a/action.yml +++ b/action.yml @@ -11,8 +11,9 @@ inputs: description: "OpenFN Project ID to deploy to" required: true endpoint_input: - description: "Lightning URL, e.g. https://app.openfn.org" - required: true + description: "Lightning URL, e.g. https://app.openfn.org. Defaults to the endpoint the workspace tracks" + required: false + default: '' force_input: description: "Deploy even if the project has changed in Lightning since the last sync" required: false @@ -29,7 +30,10 @@ runs: - run: | npm install -g @openfn/cli@^1.44.0 - args=(--endpoint "$OPENFN_DEPLOY_ENDPOINT" --no-confirm) + args=(--no-confirm) + if [ -n "$OPENFN_DEPLOY_ENDPOINT" ]; then + args+=(--endpoint "$OPENFN_DEPLOY_ENDPOINT") + fi if [ "$OPENFN_FORCE" = "true" ]; then args+=(--force) fi From a9e664d02a3e338efcde5df3e1d0e8c1cfe59256 Mon Sep 17 00:00:00 2001 From: Frank Midigo Date: Wed, 14 Oct 2026 11:14:38 +0300 Subject: [PATCH 3/4] allow workspace configuration --- README.md | 1 + action.yml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index fd07df6..1d8d076 100644 --- a/README.md +++ b/README.md @@ -38,4 +38,5 @@ jobs: project_id_input: endpoint_input: https://app.openfn.org force_input: ${{ inputs.force || false }} + workspace_input: projects/my-project # optional, defaults to the repo root ``` diff --git a/action.yml b/action.yml index 32efb14..0d90640 100644 --- a/action.yml +++ b/action.yml @@ -14,6 +14,10 @@ inputs: description: "Lightning URL, e.g. https://app.openfn.org. Defaults to the endpoint the workspace tracks" required: false default: '' + workspace_input: + description: "Folder holding the project's openfn.yaml, relative to the repo root. Defaults to the root" + required: false + default: '' force_input: description: "Deploy even if the project has changed in Lightning since the last sync" required: false @@ -44,6 +48,7 @@ runs: OPENFN_PROJECT_ID: ${{ inputs.project_id_input }} OPENFN_DEPLOY_ENDPOINT: ${{ inputs.endpoint_input }} OPENFN_FORCE: ${{ inputs.force_input }} + OPENFN_WORKSPACE: ${{ inputs.workspace_input }} # Sync relies on deploy rewriting the checkout files (.openfn/) OPENFN_NO_CHECKOUT_AFTER_DEPLOY: 'false' - name: Commit updated state file From db944c38233a9999633bd80fb5fc7ec161a85d17 Mon Sep 17 00:00:00 2001 From: Frank Midigo Date: Thu, 15 Oct 2026 20:06:06 +0300 Subject: [PATCH 4/4] Install the latest @openfn/cli --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 0d90640..d29a7f1 100644 --- a/action.yml +++ b/action.yml @@ -32,7 +32,7 @@ runs: with: node-version: 24.x - run: | - npm install -g @openfn/cli@^1.44.0 + npm install -g @openfn/cli@latest args=(--no-confirm) if [ -n "$OPENFN_DEPLOY_ENDPOINT" ]; then