1010 runs-on : ubuntu-latest
1111
1212 steps :
13+ - name : Setup global variables
14+ id : global_vars
15+ run : |
16+ echo "TODAYS_DAY=$(date '+%d')" >> $GITHUB_ENV # Ex.: 31
17+ echo "TODAYS_MONTH=$(date '+%m')" >> $GITHUB_ENV # Ex.: 08
18+ echo "TODAYS_YEAR=$(date '+%Y')" >> $GITHUB_ENV # Ex.: 2025
19+
1320 - name : Checkout repository
1421 uses : actions/checkout@v4
22+ with :
23+ python-version : 3.11
1524
1625 - name : Set up Python
1726 uses : actions/setup-python@v4
@@ -27,39 +36,28 @@ jobs:
2736 OP_SERVICE_ACCOUNT_TOKEN : ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
2837 GITHUB_TOKEN : " op://rbiv7rvkkrsdlpcrz3bmv7nmcu/GitHub generic action token for all repos/credential"
2938
30- - name : Create virtual environment
31- run : |
32- python -m venv venv
33- source venv/bin/activate
34- python -m pip install --upgrade pip
35-
36- - name : Install pur
39+ - name : Install pur and update requirements file
3740 run : |
38- source venv/bin/activate
39- pip install pur
41+ pip install --upgrade pur
42+ pur -r requirements.txt
4043
41- - name : Update requirements.txt
44+ - name : Remove venv from git tracking
4245 run : |
43- source venv/bin/activate
44- pur -r requirements.txt
46+ git clean -fdX venv
4547
4648 - name : Check for changes
4749 id : check_changes
4850 run : |
49- if git diff --exit-code; then
51+ if git diff --exit-code requirements.txt ; then
5052 echo "changes=false" >> $GITHUB_ENV
5153 else
5254 echo "changes=true" >> $GITHUB_ENV
5355 fi
5456
55- - name : Create Branch Name
56- id : createbranchname
57- if : env.changes == 'true'
58- env :
59- GITHUB_TOKEN : ${{ env.GITHUB_TOKEN }}
57+ - name : Create branch name
58+ id : create_branch_name
6059 run : |
61- branch_name="update-requirements-$(date +'%Y%m%d')"
62- echo "branchname=branch_name" >> $GITHUB_ENV
60+ echo "BRANCH=update-requirements-${{ env.TODAYS_YEAR }}-${{ env.TODAYS_MONTH }}-${{ env.TODAYS_DAY }}" >> $GITHUB_OUTPUT
6361
6462 - name : Create Pull Request
6563 id : createpr
6967 token : ${{ env.GITHUB_TOKEN }}
7068 sign-commits : true
7169 assignees : " fredericsimard"
72- branch : ${{ env.branchname }}
70+ branch : ${{ steps.create_branch_name.outputs.BRANCH }}
7371 commit-message : ' This PR updates the `requirements.txt` file with the latest versions of dependencies.'
7472 title : ' Monthly `requirements.txt` update'
75- body : |
76- This PR updates the `requirements.txt` file with the latest versions of dependencies.
73+ body : ' This PR updates the `requirements.txt` file with the latest versions of dependencies.'
0 commit comments