Skip to content

Commit

Permalink
Merge pull request #7 from dawidd6/dawidd6-patch-1
Browse files Browse the repository at this point in the history
Fix directory handling in post run
  • Loading branch information
dawidd6 authored May 14, 2020
2 parents c65cf62 + 12b0993 commit e3e388f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: ./
with:
playbook: playbook.yml
directory: ./
directory: test
key: ${{secrets.SSH_PRIVATE_KEY}}
inventory: |
[all]
Expand Down
1 change: 1 addition & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ async function main() {

if (directory) {
process.chdir(directory)
core.saveState("directory", directory)
}

if (key) {
Expand Down
4 changes: 4 additions & 0 deletions post.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
7 changes: 7 additions & 0 deletions test/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- name: Test Action
hosts: all
tasks:
- name: Copy action.yml
copy:
src: ../action.yml
dest: /tmp/action.yml

0 comments on commit e3e388f

Please sign in to comment.