forked from opendatahub-io/notebooks
-
Notifications
You must be signed in to change notification settings - Fork 8
72 lines (66 loc) · 2.36 KB
/
piplock-renewal.yaml
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
66
67
68
69
70
71
72
---
# This GitHub action is meant to update the pipfile.locks
name: Pipfile.locks Renewal Action
on: # yamllint disable-line rule:truthy
# Triggers the workflow every Wednesday at 1am UTC
schedule:
- cron: "0 1 * * 3"
workflow_dispatch: # for manual trigger workflow from GH Web UI
inputs:
branch:
description: 'Specify branch'
required: false
default: 'main'
python_version:
description: 'Select Python version to update Pipfile.lock'
required: false
default: '3.11'
type: choice
options:
- '3.11'
- '3.9'
- '3.8'
update_optional_dirs:
description: 'Include optional directories in update'
required: false
default: 'false'
type: choice
options:
- 'true'
- 'false'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
env:
BRANCH: ${{ github.event.inputs.branch || 'main' }}
PYTHON_VERSION: ${{ github.event.inputs.python_version || '3.11' }}
INCLUDE_OPT_DIRS: ${{ github.event.inputs.update_optional_dirs || 'false' }}
steps:
# Checkout the specified branch from the specified organization
- name: Checkout code from the specified branch
uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH }}
token: ${{ secrets.GH_ACCESS_TOKEN }}
# Configure Git
- name: Configure Git
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
# Setup Python environment with the specified version (or default to '3.11')
- name: Setup Python environment
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
# Install pipenv
- name: Install pipenv
run: pip install pipenv
# Run makefile recipe to refresh Pipfile.lock and push changes back to the branch
- name: Run make refresh-pipfilelock-files and push the changes back to the branch
run: |
make refresh-pipfilelock-files PYTHON_VERSION=${{ env.PYTHON_VERSION }} INCLUDE_OPT_DIRS=${{ env.INCLUDE_OPT_DIRS }}
git add .
git commit -m "Update Pipfile.lock files by piplock-renewal.yaml action"
git push origin ${{ env.BRANCH }}