Skip to content

Commit

Permalink
Set default filetype choice in CI.
Browse files Browse the repository at this point in the history
This prevents interactive prompting during test builds
  • Loading branch information
edibotopic committed Sep 11, 2024
1 parent c6aec1e commit 40c2cb5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test-starter-pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
- name: Check out repo
uses: actions/checkout@v4
- name: Run init and build
env:
default_filetype_choice: md # don't prompt for user choice
run: sp-tests/run-init-and-build.sh
- name: Add some files, build, and test
run: sp-tests/add-files-and-build.sh
Expand Down Expand Up @@ -46,6 +48,8 @@ jobs:
- name: Check out repo
uses: actions/checkout@v4
- name: Run init and build
env:
default_filetype_choice: md # don't prompt for user choice
run: sp-tests/run-init-and-build.sh docs
- name: Add some files, build, and test
run: sp-tests/add-files-and-build.sh docs
Expand Down
20 changes: 11 additions & 9 deletions init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ while true; do
done
}

# If variable filetype choice is defined in CI then don't prompt user for choice
# If default variable for filetype choice is defined in CI then don't prompt user for choice
if [ -z "${default_filetype_choice:-}" ]; then
promptForFileChoice
else
Expand Down Expand Up @@ -111,14 +111,16 @@ echo "Copying contents to the installation directory..."
cp -R "$temp_directory"/sp-files/* "$temp_directory"/sp-files/.??* "$install_directory"

# Delete files with unpreferred filetype in the installation directory
if [ "$file_type" == 'md' ]; then
echo "Deleting rst files..."
rm "$install_directory"/index.rst
rm "$install_directory"/doc-cheat-sheet.rst
else
echo "Deleting md files..."
rm "$install_directory"/index.md
rm "$install_directory"/doc-cheat-sheet-myst.md
if [ ! -z "${default_filetype_choice:-}" ]; then
if [ "$file_type" == 'md' ]; then
echo "Deleting rst files..."
rm "$install_directory"/index.rst
rm "$install_directory"/doc-cheat-sheet.rst
else
echo "Deleting md files..."
rm "$install_directory"/index.md
rm "$install_directory"/doc-cheat-sheet-myst.md
fi
fi

# Ensure GitHub workflows and woke config are placed in the repo root
Expand Down

0 comments on commit 40c2cb5

Please sign in to comment.