Skip to content

Commit f49b8be

Browse files
refactor: Updated 'upgrade requirements' workflow to use reusable workflows (#156)
1 parent 69282c8 commit f49b8be

File tree

1 file changed

+18
-62
lines changed

1 file changed

+18
-62
lines changed

.github/workflows/upgrade-python-requirements.yml

Lines changed: 18 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -2,67 +2,23 @@ name: Upgrade Requirements
22

33
on:
44
schedule:
5-
# will start the job at 02:00 UTC every monday
6-
- cron: "0 2 * * 1"
5+
- cron: "0 2 * * 1"
76
workflow_dispatch:
8-
inputs:
9-
branch:
10-
description: "Target branch to create requirements PR against"
11-
required: true
12-
default: 'master'
13-
7+
inputs:
8+
branch:
9+
description: 'Target branch to create requirements PR against'
10+
required: true
11+
default: 'master'
1412
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-
67-
from: github-actions <[email protected]>
68-
body: Upgrade python requirements workflow in ${{github.repository}} failed! For details see "github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
13+
call-upgrade-python-requirements-workflow:
14+
with:
15+
branch: ${{ github.event.inputs.branch }}
16+
team_reviewers: "arbi-bom"
17+
email_address: [email protected]
18+
send_success_notification: false
19+
secrets:
20+
requirements_bot_github_token: ${{ secrets.REQUIREMENTS_BOT_GITHUB_TOKEN }}
21+
requirements_bot_github_email: ${{ secrets.REQUIREMENTS_BOT_GITHUB_EMAIL }}
22+
edx_smtp_username: ${{ secrets.EDX_SMTP_USERNAME }}
23+
edx_smtp_password: ${{ secrets.EDX_SMTP_PASSWORD }}
24+
uses: edx/.github/.github/workflows/upgrade-python-requirements.yml@master

0 commit comments

Comments
 (0)