Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 31f1553

Browse files
authored
Merge pull request #442 from edx/jawayria/upgrade-workflow
feat: Added upgrade-python-requirements workflow
2 parents a938180 + c854b45 commit 31f1553

1 file changed

Lines changed: 81 additions & 0 deletions

File tree

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Upgrade Requirements
2+
3+
on:
4+
schedule:
5+
# will start the job at 4:15 UTC on 13th and 28th of every month
6+
- cron: "15 4 13,28 * *"
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="masters-devs-cosmonauts" --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: masters-requirements-update@edx.opsgenie.net
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 }}"
69+
70+
- name: Send success notification
71+
if: ${{ success() }}
72+
uses: dawidd6/action-send-mail@v3
73+
with:
74+
server_address: email-smtp.us-east-1.amazonaws.com
75+
server_port: 465
76+
username: ${{secrets.EDX_SMTP_USERNAME}}
77+
password: ${{secrets.EDX_SMTP_PASSWORD}}
78+
subject: Upgrade python requirements workflow executed successfully in ${{github.repository}}
79+
to: masters-requirements-update@edx.opsgenie.net
80+
from: github-actions <github-actions@edx.org>
81+
body: Upgrade python requirements workflow in ${{github.repository}} successfully created 'Python Requirements Update' PR. Please review it "github.com/${{ github.repository }}/pulls"

0 commit comments

Comments
 (0)