diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5754b40..6fd603e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: uses: ./ with: playbook: playbook.yml - directory: ./ + directory: test key: ${{secrets.SSH_PRIVATE_KEY}} inventory: | [all] diff --git a/main.js b/main.js index 3ae105c..8ff524a 100644 --- a/main.js +++ b/main.js @@ -20,6 +20,7 @@ async function main() { if (directory) { process.chdir(directory) + core.saveState("directory", directory) } if (key) { diff --git a/post.js b/post.js index 400221d..b5441ba 100644 --- a/post.js +++ b/post.js @@ -8,10 +8,14 @@ function rm(file) { async function main() { try { + const directory = core.getState("directory") const keyFile = core.getState("keyFile") const inventoryFile = core.getState("inventoryFile") const vaultPasswordFile = core.getState("vaultPasswordFile") + if (directory) + process.chdir(directory) + if (keyFile) rm(keyFile) diff --git a/test/playbook.yml b/test/playbook.yml new file mode 100644 index 0000000..aaae8f5 --- /dev/null +++ b/test/playbook.yml @@ -0,0 +1,7 @@ +- name: Test Action + hosts: all + tasks: + - name: Copy action.yml + copy: + src: ../action.yml + dest: /tmp/action.yml