Update requirements #229
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
name: Update requirements | |
# Run workflow once per week and on pushes to main | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: [main] | |
schedule: | |
- cron: "0 0 */7 * *" # run once per week | |
# checkout needs 'contents:read' | |
# pull request needs 'pull-requests:write' and 'contents:write' | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
update_requirements: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
- name: Install required packages | |
run: | | |
poetry update | |
poetry install --no-root | |
- name: Update requirements file | |
run: | | |
echo "# AUTOMATICALLY GENERATED. DO NOT EDIT." > requirements.txt | |
poetry export --without-hashes --format=requirements.txt >> requirements.txt | |
- name: Validate requirements file | |
run: | | |
pip install -r requirements.txt | |
- name: Run safety check over requirements file | |
run: | | |
pip install safety | |
safety check -r requirements.txt | |
continue-on-error: true | |
- name: Check for changes | |
shell: bash | |
run: git --no-pager diff -- . | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | |
- name: Create pull request | |
if: ${{ ! env.ACT }} | |
id: pull-request | |
uses: peter-evans/create-pull-request@b4d51739f96fca8047ad065eccef63442d8e99f7 # This commit corresponds to tag 4.2.0 | |
with: | |
commit-message: Update Python requirements | |
committer: GitHub Actions <[email protected]> | |
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
base: main | |
branch: update-python-requirements | |
delete-branch: true | |
title: Update Python requirements | |
body: | | |
### :arrow_heading_up: Summary | |
- Update Python package version diff from ${{ github.sha }} on ${{ steps.date.outputs.date }} | |
labels: | | |
dependencies | |
draft: false |