Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
72 lines (71 loc) · 2.51 KB
/
Copy pathaction.yml
File metadata and controls
72 lines (71 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: 'openfn pull and commit'
description: 'Pulls an OpenFn project from a Lightning instance into an openfn.yaml workspace; commits to a branch'
branding:
icon: 'download'
color: 'purple'
inputs:
secret_input:
description: "OpenFN API KEY"
required: true
project_id_input:
description: "OpenFN Project ID"
required: true
endpoint_input:
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: ''
alias_input:
description: "Local alias for the project, e.g. when another project in the workspace already uses 'main'. Only needed on the first pull: later pulls keep the alias"
required: false
default: ''
branch_input:
description: 'Branch to commit the project to'
required: true
commit_message_input:
description: "Pull Commit Message"
required: true
runs:
using: "composite"
steps:
- name: Checkout Project export
uses: actions/checkout@v6
with:
ref: ${{ inputs.branch_input }}
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: 24.x
- name: Install OpenFn CLI
run: npm install -g @openfn/cli@latest
shell: bash
- name: Pull project from OpenFn
run: |
# The CLI finds the git branch from inside the workspace, so the folder
# has to exist before the first pull
mkdir -p "${OPENFN_WORKSPACE:-.}"
# Lightning is the source of truth: --force overwrites local files,
# --track makes this branch track the project
args=(--force --track --log info)
if [ -n "$OPENFN_PULL_ENDPOINT" ]; then
args+=(--endpoint "$OPENFN_PULL_ENDPOINT")
fi
if [ -n "$OPENFN_ALIAS" ]; then
args+=(--alias "$OPENFN_ALIAS")
fi
openfn project pull "$OPENFN_PROJECT_ID" "${args[@]}"
shell: bash
env:
OPENFN_API_KEY: ${{ inputs.secret_input }}
OPENFN_PROJECT_ID: ${{ inputs.project_id_input }}
OPENFN_PULL_ENDPOINT: ${{ inputs.endpoint_input }}
OPENFN_WORKSPACE: ${{ inputs.workspace_input }}
OPENFN_ALIAS: ${{ inputs.alias_input }}
- name: Commit new state file
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: ${{ inputs.commit_message_input }}
branch: ${{ inputs.branch_input }}