Skip to content

Commit

Permalink
GitHub actions poetry (#27435)
Browse files Browse the repository at this point in the history
* switched to poetry

* added dependencies to toml

* added --with ci flag

* edit after validation failed

* edit

* added dateparser

* locked the file

* removed pipfile

* returned files

* edit yml

* reverted changes

* reverted changes

* moved dateparser to dev

* locked poetry

* removed flake8

* edited poetry lock

* edited poetry lock

* fixed the action to run on this specific pr

* fixed the action to run on this specific pr

* edit

* edit

* edit

* reverted changes to filled form and handle external pr

* edited handle stale prs

* edited handle stale prs again

* edited handle stale prs with ci

* check sync-contrib-base-branch, and revert stale branches

* reverted the base branch, and check base branch on change

* reverted the base branch, and check base branch on change

* reverted the base branch, and check base branch on change

* test close pr

* test close pr
  • Loading branch information
merit-maita authored Jun 25, 2023
1 parent 07dd1e5 commit d473b04
Show file tree
Hide file tree
Showing 8 changed files with 333 additions and 44 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/check-contribution-form-filled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Setup Poetry
uses: Gr1N/setup-poetry@v8
- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv==2021.5.29
cd Utils/github_workflow_scripts
pipenv sync
poetry install --with ci
- name: Check if contribution form needs to be filled
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Checking if contribution form needs to be filled for PR: $PR_NUMBER"
cd Utils/github_workflow_scripts
pipenv run ./check_if_needs_to_fill_contribution_form.py --pr_number $PR_NUMBER --github_token $GITHUB_TOKEN
poetry run ./check_if_needs_to_fill_contribution_form.py --pr_number $PR_NUMBER --github_token $GITHUB_TOKEN
9 changes: 4 additions & 5 deletions .github/workflows/create-internal-pr-from-external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: '3.9'

- name: Setup Poetry
uses: Gr1N/setup-poetry@v8
- name: Print Context
run: |
echo "$GITHUB_CONTEXT"
Expand All @@ -25,15 +26,13 @@ jobs:

- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv==2021.5.29
poetry install --with ci
- name: Create Internal PR
env:
CONTENTBOT_GH_ADMIN_TOKEN: ${{ secrets.CONTENTBOT_GH_ADMIN_TOKEN }}
EVENT_PAYLOAD: ${{ toJson(github.event) }}
run: |
echo "Creating an internal PR from original merged external PR ${{ github.event.pull_request.html_url }}"
cd Utils/github_workflow_scripts
pipenv sync
pipenv run ./create_internal_pr.py
poetry run ./create_internal_pr.py
echo "Finished Creating Internal PR"
12 changes: 5 additions & 7 deletions .github/workflows/handle-new-external-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: '3.9'

- name: Setup Poetry
uses: Gr1N/setup-poetry@v8
- name: Print Context
run: |
echo "$GITHUB_CONTEXT"
Expand All @@ -29,8 +30,7 @@ jobs:

- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv==2021.5.29
poetry install --with ci
- name: Update External PR
env:
Expand All @@ -39,9 +39,7 @@ jobs:
run: |
echo "Updating External PR ${{ github.event.pull_request.html_url }}"
cd Utils/github_workflow_scripts
pipenv sync
pipenv run ./handle_external_pr.py
poetry run ./handle_external_pr.py
echo "Finished Handling External PR"
- name: Send Notification
env:
Expand All @@ -51,4 +49,4 @@ jobs:
run: |
echo "Sending notification about External PR ${{ github.event.pull_request.html_url }}"
cd Utils/github_workflow_scripts
pipenv run ./send_slack_message.py
poetry run ./send_slack_message.py
16 changes: 8 additions & 8 deletions .github/workflows/handle-stale-branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Setup Poetry
uses: Gr1N/setup-poetry@v8
- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv==2021.5.29
poetry install --with ci
- name: Delete Stale Contributor Branches
env:
CONTENTBOT_GH_ADMIN_TOKEN: ${{ secrets.CONTENTBOT_GH_ADMIN_TOKEN }}
run: |
echo "Deleting stale contribution base branches (contrib/*)"
cd Utils/github_workflow_scripts
pipenv sync
pipenv run ./delete_stale_contrib_branches.py
poetry run ./delete_stale_contrib_branches.py
echo "Finished deleting stale branches"
handle_stale_non_contributor_branches:
Expand All @@ -41,16 +41,16 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Setup Poetry
uses: Gr1N/setup-poetry@v8
- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv==2021.5.29
poetry install --with ci
- name: Delete Stale Non Contributor Branches
env:
CONTENTBOT_GH_ADMIN_TOKEN: ${{ secrets.CONTENTBOT_GH_ADMIN_TOKEN }}
run: |
echo "Deleting stale non contribution branches"
cd Utils/github_workflow_scripts
pipenv sync
pipenv run ./delete_stale_non_contrib_branches.py
poetry run ./delete_stale_non_contrib_branches.py
echo "Finished deleting stale branches"
8 changes: 4 additions & 4 deletions .github/workflows/sync-contribution-base-branch-on-change.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Setup Poetry
uses: Gr1N/setup-poetry@v8
- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv==2021.5.29
poetry install --with ci
- name: Sync Base Branch to Master
env:
CONTENTBOT_GH_ADMIN_TOKEN: ${{ secrets.CONTENTBOT_GH_ADMIN_TOKEN }}
run: |
echo "Updating contribution base branch (contrib/*)"
cd Utils/github_workflow_scripts
pipenv sync
pipenv run ./sync_contrib_base.py --branch_name ${{ github.event.pull_request.base.ref }}
poetry run ./sync_contrib_base.py --branch_name ${{ github.event.pull_request.base.ref }}
echo "Finished updating base branch"
8 changes: 4 additions & 4 deletions .github/workflows/sync-contribution-base-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Setup Poetry
uses: Gr1N/setup-poetry@v8
- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv==2021.5.29
poetry install --with ci
- name: Sync Base Branch to Master
env:
CONTENTBOT_GH_ADMIN_TOKEN: ${{ secrets.CONTENTBOT_GH_ADMIN_TOKEN }}
run: |
echo "Updating contribution base branches (contrib/*)"
cd Utils/github_workflow_scripts
pipenv sync
pipenv run ./sync_contrib_base.py
poetry run ./sync_contrib_base.py
echo "Finished updating base branches"
Loading

0 comments on commit d473b04

Please sign in to comment.