-
Notifications
You must be signed in to change notification settings - Fork 10
65 lines (58 loc) · 2.64 KB
/
upgrade-python-requirements.yml
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
name: Upgrade Requirements
on:
schedule:
- cron: "0 2 * * 1"
workflow_dispatch:
inputs:
branch:
description: "Target branch to create requirements PR against"
required: true
default: 'main'
jobs:
upgrade_requirements:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.12"]
steps:
- name: setup target branch
run: echo "target_branch=$(if ['${{ github.event.inputs.branch }}' = '']; then echo 'main'; else echo '${{ github.event.inputs.branch }}'; fi)" >> $GITHUB_ENV
- uses: actions/checkout@v1
with:
ref: ${{ env.target_branch }}
- name: setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: make upgrade
run: |
cd $GITHUB_WORKSPACE
make upgrade
- name: setup testeng-ci
run: |
git clone https://github.com/edx/testeng-ci.git
cd $GITHUB_WORKSPACE/testeng-ci
pip install -r requirements/base.txt
- name: create pull request
env:
GITHUB_TOKEN: ${{ secrets.REQUIREMENTS_BOT_GITHUB_TOKEN }}
GITHUB_USER_EMAIL: ${{ secrets.REQUIREMENTS_BOT_GITHUB_EMAIL }}
run: | # replace user-reviewers and team-reviewers accordingly
cd $GITHUB_WORKSPACE/testeng-ci
python -m jenkins.pull_request_creator --repo-root=$GITHUB_WORKSPACE \
--target-branch="${{ env.target_branch }}" --base-branch-name="upgrade-python-requirements" \
--commit-message="chore: Updating Python Requirements" --pr-title="Python Requirements Update" \
--pr-body="Python requirements update.Please review the [changelogs](https://2u-internal.atlassian.net/wiki/spaces/AC/pages/2626852/Python+Package+Changelogs) for the upgraded packages." \
--user-reviewers="" --team-reviewers="enterprise-titans" --delete-old-pull-requests
- name: Send failure notification
if: ${{ failure() }}
uses: dawidd6/action-send-mail@v3
with:
server_address: email-smtp.us-east-1.amazonaws.com
server_port: 465
username: ${{secrets.EDX_SMTP_USERNAME}}
password: ${{secrets.EDX_SMTP_PASSWORD}}
subject: Upgrade python requirements workflow failed in ${{github.repository}}
to: [email protected] # replace the email with team's email address
from: github-actions <[email protected]>
body: Upgrade python requirements workflow in ${{github.repository}} failed! For details see "github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"