Skip to content

Commit ee1c69d

Browse files
Error handling for BASE_DIR
1 parent dc8be45 commit ee1c69d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

.github/workflows/python_test.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,21 @@ jobs:
3232
path: ~/.local
3333
key: dotlocal-${{ runner.os }}-${{ hashFiles('.github/workflows/python_test.yml') }}
3434
# - run: echo '${{ steps.cash-money.outputs.cache-hit }}' # true if cache-hit occured on the primary key
35-
- name: set variables
35+
- name: set cwd and change to directory
3636
run: |
3737
BASE_DIR=$(cat BASE_DIR)
3838
echo "BASE_DIR=$BASE_DIR" >> $GITHUB_ENV
39-
- run: cd ${{ env.BASE_DIR }}
39+
cd ${{ env.BASE_DIR }} || unset BASE_DIR; BASE_DIR=$(pwd) && echo "BASE_DIR=$BASE_DIR" >> $GITHUB_ENV
4040
- name: Read .tool-versions # dynamic versions
4141
uses: marocchino/tool-versions-action@v1
4242
id: versions
4343
with:
4444
path: ${{ env.BASE_DIR }}/.tool-versions
45-
# - name: shuffle files
46-
# run: |
47-
# cat ${{ env.BASE_DIR }}/.tool-versions | awk '/python/ {print $NF}' >> ${{ env.BASE_DIR }}/.python-version
48-
# [[ -e "$(pwd)/pyproject.toml" ]] && mv "$(pwd)/pyproject.toml" "$(pwd)/pyproject.toml.bak"
49-
# cp "${{ env.BASE_DIR }}/pyproject.toml" $(pwd)/
45+
- name: shuffle files
46+
run: |
47+
cat ${{ env.BASE_DIR }}/.tool-versions | awk '/python/ {print $NF}' >> ${{ env.BASE_DIR }}/.python-version
48+
[[ -e "$(pwd)/pyproject.toml" ]] && mv "$(pwd)/pyproject.toml" "$(pwd)/pyproject.toml.bak"
49+
cp "${{ env.BASE_DIR }}/pyproject.toml" $(pwd)/
5050
- name: setup python
5151
uses: actions/setup-python@v4
5252
with:

0 commit comments

Comments
 (0)