Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fuzzylabs/gha-poetry-update
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.0
Choose a base ref
...
head repository: fuzzylabs/gha-poetry-update
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 6 commits
  • 4 files changed
  • 2 contributors

Commits on Mar 14, 2024

  1. Release - v1 (#4)

    proudfeet authored Mar 14, 2024
    Copy the full SHA
    a30be0d View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    Copy the full SHA
    7e49b9a View commit details
  3. Copy the full SHA
    f3ec041 View commit details

Commits on Apr 9, 2024

  1. Copy the full SHA
    a7c9fa2 View commit details

Commits on Apr 10, 2024

  1. Merge pull request #6 from fuzzylabs/FUZB-92-Multiline-Bug-Fix-Signed…

    …-Branch
    
    [FUZB-92] Fix bug for multi-line updates on "make poetry update public" PR
    EchoStatements authored Apr 10, 2024
    Copy the full SHA
    c8285e4 View commit details

Commits on Apr 15, 2024

  1. [FUZB-130] Poetry update for multi projects (#7)

    * [FUZB-92] Bug fix changing version check to not check for micro release
    
    * [FUZB-92] Allow directory to be given as argument
    
    * [FUZB-92] Add echo statement
    
    * [FUZB-92] Add update poetry
    
    * [FUZB-92] Try adding installation directory arguments
    
    * [FUZB-92] Fix arg syntax
    
    * [FUZB-92] Install from lock file
    
    * [FUZB-92] Set virtualenvs-create to true
    
    * [FUZB-92] add echo statements
    
    * [FUZB-92] Change to allow update message
    
    * [FUZB-92] Change to allow multiple PRs
    
    * [FUZB-130] Update to add env variables to GITHUB_ENV
    
    * [FUZB-130] Fix bash script
    
    * [FUZB-130] Add missing $
    
    * [FUZB-130] Move string manipulation into sed
    
    * [FUZB-130] Fix space in variable assignment
    
    * [FUZB-130] Remove trailing dashes
    
    * [FUZB-130] Add quotes to assignment
    
    * [FUZB-130] Debugging statements
    
    * [FUZB-130] Change variable assignment syntax
    
    * [FUZB-130] Change variable assignment syntax
    
    * [FUZB-130] Debug commit
    
    * [FUZB-130] Add quotes around assignment
    
    * [FUZB-130] Add quotes around assignment
    
    * [FUZB-130] Change to double quotes
    
    * [FUZB-130] Debug commit
    
    * [FUZB-130] use alternative assignment syntax
    
    * [FUZB-130] Remove spaces
    
    * [FUZB-130] Syntax change
    
    * [FUZB-130] bug fixes
    
    * [FUZB-130] Set PR details from env variables
    
    * [FUZB-130] Set Commit Message
    
    * [FUZB-130] Add slash to directory
    
    * [FUZB-130] echo current directory
    
    * [FUZB-130] echo current directory
    
    * [FUZB-130] Add run update condition to generating commit message and PR details
    
    * [FUZB-130] More debug statements
    
    * [FUZB-130] More debug statements
    
    * [FUZB-130] isolate update step
    
    * [FUZB-130] isolate text writing step
    
    * [FUZB-130] More debugging
    
    * [FUZB-130] Fix comparison to check if multi-project repo
    
    * [FUZB-130] Add back in updating grep
    
    * [FUZB-130] Remove quotes around poetry
    
    * [FUZB-130] Remove quotes around poetry
    
    * [FUZB-130] Add grep back in
    
    * [FUZB-130] Check if the problem is writing an empty string to file
    
    * [FUZB-130] Add echo as workaround
    
    * [FUZB-130] Change echo to be combined with cat
    
    * [FUZB-130] Change echo to be combined with cat
    
    * [FUZB-130] Experiment with removing all text processing from poetry update message
    
    * [FUZB-130] Fix test new test condition.
    
    * [FUZB-130] Remove trailing dashes and second attempt at fixing conditional
    
    * [FUZB-130] Remove commented out text processing
    
    * [FUZB-130] Add example to README
    
    * [FUZB-130] Grammar and unnecessary `pwd` command
    EchoStatements authored Apr 15, 2024
    Copy the full SHA
    78e5e9c View commit details
Showing with 92 additions and 21 deletions.
  1. +1 −1 .github/CODEOWNERS
  2. +0 −6 .github/ISSUE_TEMPLATE/config.yml
  3. +34 −5 README.md
  4. +57 −9 action.yml
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -4,4 +4,4 @@

# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
* @fuzzylabs/fuzzy-labs
* @fuzzylabs/public_maintainers
6 changes: 0 additions & 6 deletions .github/ISSUE_TEMPLATE/config.yml

This file was deleted.

39 changes: 34 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ jobs:
auto-update:
runs-on: ubuntu-latest
steps:
- uses: fuzzylabs/gha-poetry-update.git@main
- uses: fuzzylabs/gha-poetry-update@v1
```
### Handling Private Dependencies Example 🔐
@@ -58,7 +58,7 @@ jobs:
${{ secrets.<SSH_PRIVATE_KEY_1> }}
${{ secrets.<SSH_PRIVATE_KEY_2> }}
- uses: fuzzylabs/gha-poetry-update.git@main
- uses: fuzzylabs/gha-poetry-update@v1
```
## Action inputs
@@ -67,7 +67,7 @@ All inputs are **optional**. If not set, sensible defaults will be used.
| Name | Description | Default |
| --- | --- | --- |
| `python-version` | The python version to use with poetry, the minimum version required is >=3.10.5 | 3.10.12 |
| `python-version` | The python version to use with poetry, the minimum version required is >=3.10 | 3.10.12 |
| `poetry-version` | The poetry version to use | 1.8.2 |

### Example
@@ -86,8 +86,37 @@ jobs:
auto-update:
runs-on: ubuntu-latest
steps:
- uses: fuzzylabs/gha-poetry-update.git@main
- uses: fuzzylabs/gha-poetry-update@v1
with:
python-version: '3.10.12'
poetry-version: '1.8.2'
```
```

This action can also be used on repositories which contain multiple projects in different directories. The following example shows a workflow in which the action updates dependencies in projects in directories `project1/` `project2` and `project3`.

If dependencies are updated in one or more of these projects, a separate pull request
will be generated for each of the updated projects.

```yaml
name: Poetry Update
on:
# Run weekly on Monday at 0700AM
schedule:
- cron: "0 7 * * MON"
# Allow a manual trigger
workflow_dispatch:
jobs:
auto-update:
runs-on: ubuntu-latest
strategy:
matrix: { directory: ['project1/', 'project2/', 'project3/'] }
steps:
- uses: fuzzylabs/gha-poetry-update@v1
with:
python-version: "3.10"
directory: ${{ matrix.directory }}
```
_Note: We do not explicitly support this action with Python <=3.10.4. Though Python 3.10 is checked for as a minimum requirement, this is to capture workflows which set version generically to 3.10.X specifying only major and minor release numbers._
66 changes: 57 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: 'Poetry Update'
description: 'Runs `poetry update`, checks for newer dependencies. Creates a pull request if any updates are available.'
author: 'Fuzzy Labs'
branding:
icon: "chevrons-up"
color: "purple"
@@ -10,6 +11,9 @@ inputs:
poetry-version:
description: "The poetry version to use"
default: '1.8.2'
directory:
description: "The directory of the project files"
default: './'

runs:
using: "composite"
@@ -21,7 +25,7 @@ runs:
# Poetry 1.2 is the first release that support python >=3.8
- name: Check compatible version
run: |
min_python_version="3.10.5"
min_python_version="3.10"
min_poetry_version="1.2"
if [ "$(printf '%s\n' "$min_python_version" "${{ inputs.python-version }}" | sort -V | head -n1)" != "$min_python_version" ]; then
echo "Less than the minimum required python version: ${min_python_version}, exiting workflow"
@@ -66,6 +70,7 @@ runs:
# Check if poetry.lock exists
#----------------------------------------------
- name: Check if poetry.lock exists
working-directory: ${{ inputs.directory }}
if: env.RUN_UPDATE != 'false'
run: |
if [ -f "poetry.lock" ]; then
@@ -80,27 +85,70 @@ runs:
# Run poetry update
#----------------------------------------------
- name: Run poetry update
working-directory: ${{ inputs.directory }}
if: env.RUN_UPDATE != 'false'
run: |
UPDATE_MESSAGE=$(poetry update | grep -i 'updating' | grep -v 'Updating dependencies' | sed 's/Updating//g')
echo $UPDATE_MESSAGE
echo "UPDATE_MESSAGE=$UPDATE_MESSAGE" >> $GITHUB_ENV
echo "running install"
poetry install --no-interaction --no-root
poetry update > /var/tmp/updated_deps.txt
{
echo "UPDATE_MESSAGE<<EOF"
cat /var/tmp/updated_deps.txt
echo "EOF"
} >> $GITHUB_ENV
shell: bash

#----------------------------------------------
# Create a pull request
#----------------------------------------------
- name: Create branch name
working-directory: ${{ inputs.directory }}
if: env.RUN_UPDATE != 'false'
shell: bash
run: |
if [ ${{ inputs.directory }} == "./" ]
then
BRANCH_NAME="update/poetry-update"
BRANCH_TITLE="Update poetry dependencies"
COMMIT_MESSAGE="Chore(deps): Upgrading poetry dependencies"
else
# replace " " and "_" with dashes
BRANCH_NAME=$(echo ${{ inputs.directory }} | sed -r "s/[_ ]/-/g" | sed -r "s/\//--/g")
# remove trailing dashes
BRANCH_NAME=$(echo $BRANCH_NAME | sed -r "s/-+$//g")
# NOTE: undesirable behaviour may occur if a project directory name is excessively long (~100 chars)
# or if two projects share the same name up to substitutions of "-" with " ".
BRANCH_NAME="update/poetry-update-$BRANCH_NAME"
BRANCH_TITLE="Update poetry dependencies for ${{ inputs.directory }}"
COMMIT_MESSAGE="Chore(deps): Upgrading poetry dependencies for ${{ inputs.directory }}"
fi
{
echo "BRANCH_NAME<<EOF"
echo $BRANCH_NAME
echo "EOF"
} >> $GITHUB_ENV
{
echo "BRANCH_TITLE<<EOF"
echo $BRANCH_TITLE
echo "EOF"
} >> $GITHUB_ENV
{
echo "COMMIT_MESSAGE<<EOF"
echo $COMMIT_MESSAGE
echo "EOF"
} >> $GITHUB_ENV
- name: Create Pull Request
if: env.RUN_UPDATE != 'false'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ github.token }}
branch: update/poetry-update
title: Update poetry dependencies
commit-message: "Chore(deps): Upgrading `poetry` dependencies"
branch: ${{ env.BRANCH_NAME }}
title: ${{ env.BRANCH_TITLE }}
commit-message: ${{ env.COMMIT_MESSAGE }}
body: |
Update `poetry` dependencies to use latest compatible versions.
**Outdated packages**:
**Poetry update message**:
${{ env.UPDATE_MESSAGE }}