-
Notifications
You must be signed in to change notification settings - Fork 116
75 lines (64 loc) · 2.22 KB
/
update_requirements.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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