Skip to content

Commit 9a6f3a3

Browse files
authored
feat: Added upgrade-python-requirements workflow (#24)
* feat: Added upgrade-python-requirements workflow
1 parent c78192e commit 9a6f3a3

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Upgrade Requirements
2+
3+
on:
4+
schedule:
5+
# will start the job at 04:00 UTC every Wednesday
6+
- cron: "0 4 * * 3"
7+
workflow_dispatch:
8+
inputs:
9+
branch:
10+
description: "Target branch to create requirements PR against"
11+
required: true
12+
default: 'master'
13+
14+
jobs:
15+
upgrade_requirements:
16+
runs-on: ubuntu-20.04
17+
18+
strategy:
19+
matrix:
20+
python-version: ["3.8"]
21+
22+
steps:
23+
- name: setup target branch
24+
run: echo "target_branch=$(if ['${{ github.event.inputs.branch }}' = '']; then echo 'master'; else echo '${{ github.event.inputs.branch }}'; fi)" >> $GITHUB_ENV
25+
26+
- uses: actions/checkout@v1
27+
with:
28+
ref: ${{ env.target_branch }}
29+
30+
- name: setup python
31+
uses: actions/setup-python@v2
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
35+
- name: make upgrade
36+
run: |
37+
cd $GITHUB_WORKSPACE
38+
make upgrade
39+
40+
- name: setup testeng-ci
41+
run: |
42+
git clone https://github.com/edx/testeng-ci.git
43+
cd $GITHUB_WORKSPACE/testeng-ci
44+
pip install -r requirements/base.txt
45+
- name: create pull request
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.REQUIREMENTS_BOT_GITHUB_TOKEN }}
48+
GITHUB_USER_EMAIL: ${{ secrets.REQUIREMENTS_BOT_GITHUB_EMAIL }}
49+
run: |
50+
cd $GITHUB_WORKSPACE/testeng-ci
51+
python -m jenkins.pull_request_creator --repo-root=$GITHUB_WORKSPACE \
52+
--target-branch="${{ env.target_branch }}" --base-branch-name="upgrade-python-requirements" \
53+
--commit-message="chore: Updating Python Requirements" --pr-title="Python Requirements Update" \
54+
--pr-body="Python requirements update.Please review the [changelogs](https://openedx.atlassian.net/wiki/spaces/TE/pages/1001521320/Python+Package+Changelogs) for the upgraded packages." \
55+
--user-reviewers="" --team-reviewers="arbi-bom" --delete-old-pull-requests
56+
57+
- name: Send failure notification
58+
if: ${{ failure() }}
59+
uses: dawidd6/action-send-mail@v3
60+
with:
61+
server_address: email-smtp.us-east-1.amazonaws.com
62+
server_port: 465
63+
username: ${{secrets.EDX_SMTP_USERNAME}}
64+
password: ${{secrets.EDX_SMTP_PASSWORD}}
65+
subject: Upgrade python requirements workflow failed in ${{github.repository}}
66+
to: arbi-bom@edx.org
67+
from: github-actions <github-actions@edx.org>
68+
body: Upgrade python requirements workflow in ${{github.repository}} failed! For details see "github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"

0 commit comments

Comments
 (0)