Skip to content

Commit

Permalink
Add working-directory support
Browse files Browse the repository at this point in the history
  • Loading branch information
hummeltech committed Jul 28, 2023
1 parent 3ff541f commit 7c49ae4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Tests

on:
Expand All @@ -10,6 +11,7 @@ jobs:
strategy:
matrix:
box:
- freebsd/FreeBSD-12.4-RELEASE
- freebsd/FreeBSD-13.2-RELEASE
- generic/freebsd12
- generic/freebsd13
Expand All @@ -26,7 +28,7 @@ jobs:
save_box_to_cache: true
use_cached_box: true

- name: Run Test (VM)
- name: Run Test (uname) (VM)
run: |
if [ "$(uname -s)" = "FreeBSD" ]; then
echo "FreeBSD detected."
Expand All @@ -36,7 +38,7 @@ jobs:
fi
shell: bash --noprofile --norc -euo pipefail {0}

- name: Run Test (Host)
- name: Run Test (uname) (Host)
run: |
if [ "$(uname -s)" = "Darwin" ]; then
echo "Darwin detected."
Expand All @@ -45,3 +47,19 @@ jobs:
exit 1
fi
shell: /bin/bash --noprofile --norc -euo pipefail {0}

- name: Prepare Test (working-directory) (VM)
run: |
mkdir new_working_directory
shell: bash --noprofile --norc -euo pipefail {0}

- name: Run Test (working-directory) (VM)
run: |
if [ "$(basename ${PWD})" = "new_working_directory" ]; then
echo "Expected working directory detected."
else
echo "Expected working directory not detected."
exit 1
fi
shell: bash --noprofile --norc -euo pipefail {0}
working-directory: new_working_directory
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ runs:
echo "#!/bin/bash" | sudo tee /usr/local/bin/bash
echo "SCRIPT=\$(mktemp)" | sudo tee -a /usr/local/bin/bash
echo "echo \"#!/usr/bin/env bash\" >> \${SCRIPT}" | sudo tee -a /usr/local/bin/bash
echo "echo \"cd $(pwd)\" >> \${SCRIPT}" | sudo tee -a /usr/local/bin/bash
echo "echo \"cd \${PWD}\" >> \${SCRIPT}" | sudo tee -a /usr/local/bin/bash
echo "echo \"set -euxo pipefail\" >> \${SCRIPT}" | sudo tee -a /usr/local/bin/bash
echo "echo \"bash \$@\" >> \${SCRIPT}" | sudo tee -a /usr/local/bin/bash
echo "mv \${SCRIPT} ${{ runner.temp }}/command.sh" | sudo tee -a /usr/local/bin/bash
Expand All @@ -138,7 +138,7 @@ runs:
sudo chmod +x /usr/local/bin/bash
shell: bash

- name: Package Vagrant Box and save to GitHub Actions Cache
- name: Package Vagrant Box
if: inputs.save_box_to_cache
uses: gacts/run-and-post-run@v1
with:
Expand Down

0 comments on commit 7c49ae4

Please sign in to comment.