Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept additional options to pass to poetry #60

Merged
merged 13 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
# feel free to update it
- run: |
source .github/scripts/assert.sh
assert_in "1.1.10" "$(poetry --version)"
assert_in "1.1.11" "$(poetry --version)"

# Make sure scripts are not deleted.
# If we deleted the scripts folder (or subfolders) by accident,
Expand Down Expand Up @@ -180,3 +180,26 @@ jobs:
assert_in "true" "$(poetry config virtualenvs.in-project)"
assert_in "/home/runner/.cache/virtualenvs" "$(poetry config virtualenvs.path)"
assert_in "false" "$(poetry config installer.parallel)"

test-installation-arguments-version-unspecified:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./
with:
installation-arguments: --git https://github.com/python-poetry/poetry.git@69bd6820e320f84900103fdf867e24b355d6aa5d
- run: |
source .github/scripts/assert.sh
assert_in "1.1.9" "$(poetry --version)"

test-installation-arguments-version-specified:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./
with:
version: 1.1.7
installation-arguments: --git https://github.com/python-poetry/poetry.git@69bd6820e320f84900103fdf867e24b355d6aa5d
- run: |
source .github/scripts/assert.sh
assert_in "1.1.9" "$(poetry --version)"
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ If you want to set Poetry config settings, or install a specific version, you ca
installer-parallel: true
```

The action is fully tested for MacOS and Ubuntu runners, on Poetry versions >= 1.1.0.
If you need to pass extra arguments to the installer script, you can specify these with `installation-arguments`.

If you're using this with Windows, see the [Running on Windows](#windows) section.
The action is fully tested for MacOS and Ubuntu runners, on Poetry versions >= 1.1.0. If you're using this with Windows, see the [Running on Windows](#windows) section.

## Defaults

Expand All @@ -47,6 +47,16 @@ virtualenvs-path: {cache-dir}/virtualenvs
installer-parallel: true
```

You can specify installation arguments directly to the poetry installer using the installation-arguments in the following
way:

```yaml
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
installation-arguments: --git https://github.com/python-poetry/poetry.git@69bd6820e320f84900103fdf867e24b355d6aa5d
```

If you want to make further config changes - e.g., to change one of the `experimental` Poetry config settings, or just
to make changes to the Poetry config *after* invoking the action - you can do so in a subsequent step, like this:

Expand All @@ -63,7 +73,7 @@ This section contains a collection of workflow examples to try and help
- Demonstrate how to implement caching for performance improvements
- Clarify the implications of different settings

Some of the examples are a bit long, so here are some links
Some examples are a bit long, so here are some links

- [Testing](#testing)
- [Testing (using an OS matrix)](#testing-using-a-matrix)
Expand Down
7 changes: 5 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ inputs:
description: "Whether to install many packages at once or one by one. This can fix PyPI DNS resolution errors, but also slows down the installation"
required: false
default: "true"
installation-arguments:
description: "Arguments passed directly to the Poetry installation script. For example --force."
required: false
runs:
using: "composite"
steps:
Expand All @@ -43,9 +46,9 @@ runs:
echo -e "\033[33mInstalling Poetry 👷\033[0m\n"

if [ "${{ inputs.version }}" == "latest" ]; then
POETRY_HOME=$path python3 $installation_script --yes
POETRY_HOME=$path python3 $installation_script --yes ${{ inputs.installation-arguments}}
else
POETRY_HOME=$path python3 $installation_script --yes --version=${{ inputs.version }}
POETRY_HOME=$path python3 $installation_script --yes --version=${{ inputs.version }} ${{ inputs.installation-arguments}}
fi

echo "$path/bin" >>$GITHUB_PATH
Expand Down