-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #219 from OpenCOMPES/dependency_update_action
Dependency update action
- Loading branch information
Showing
5 changed files
with
317 additions
and
483 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Update depencies in poetry lockfile | ||
|
||
on: | ||
schedule: | ||
- cron: '0 1 * * 1' | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- pyproject.toml | ||
|
||
jobs: | ||
update_dependencies: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Check out repo and set up Python | ||
- uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
|
||
- uses: tibdex/github-app-token@v1 | ||
id: generate-token | ||
with: | ||
app_id: ${{ secrets.APP_ID }} | ||
private_key: ${{ secrets.APP_PRIVATE_KEY }} | ||
|
||
# Use cached python and dependencies, install poetry | ||
- name: "Setup Python, Poetry and Dependencies" | ||
uses: packetcoders/action-setup-cache-python-poetry@main | ||
with: | ||
python-version: 3.8 | ||
poetry-version: 1.2.2 | ||
|
||
# update poetry lockfile | ||
- name: "Update poetry lock file" | ||
id: update | ||
run: | | ||
poetry self update | ||
exec 5>&1 | ||
UPDATE_OUTPUT=$(poetry update|tee >(cat - >&5)) | ||
echo "UPDATE_OUTPUT<<EOF" >> $GITHUB_OUTPUT | ||
echo "$UPDATE_OUTPUT" >> $GITHUB_OUTPUT | ||
echo "EOF" >> $GITHUB_OUTPUT | ||
- name: Export requirements.txt | ||
run: | | ||
poetry export --without-hashes --format=requirements.txt -o docs/requirements.txt -E docs -E notebook | ||
- name: Obtain git status | ||
id: status | ||
run: | | ||
exec 5>&1 | ||
STATUS=$(git status|tee >(cat - >&5)) | ||
echo "STATUS<<EOF" >> $GITHUB_OUTPUT | ||
echo "$STATUS" >> $GITHUB_OUTPUT | ||
echo "EOF" >> $GITHUB_OUTPUT | ||
# create pull request if necessary | ||
- name: "Create Pull Request" | ||
uses: peter-evans/create-pull-request@v5 | ||
if: ${{ contains(steps.status.outputs.STATUS, 'poetry.lock') || contains(steps.status.outputs.STATUS, 'requirements.txt')}} | ||
with: | ||
token: ${{ steps.generate-token.outputs.token }} | ||
commit-message: Update dependencies | ||
title: "Update dependencies" | ||
body: | | ||
Dependency updates using Poetry: | ||
${{ steps.update.outputs.UPDATE_OUTPUT }} |
Oops, something went wrong.