generated from actions/container-action
-
Notifications
You must be signed in to change notification settings - Fork 4
81 lines (69 loc) · 2.33 KB
/
cron-research.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: update research codebase
on:
schedule:
- cron: "0 6 * * 1" # 06:00 of every Monday
workflow_dispatch:
jobs:
dev_updates:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.PR_MAINTAIN }}
repository: Project-MONAI/research-contributions
ref: main
- uses: actions/setup-python@v3
with:
python-version: 3.8
- name: Cache weekly timestamp
id: pip-cache
run: echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
shell: bash
- name: Cache for pip
uses: actions/cache@v3
id: cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
- name: Install tools
run: |
sudo apt-get -y install dos2unix libtinfo5
python -m pip install --upgrade pip wheel
pip install isort black autopep8 torch numpy
pip install pycodestyle!=2.11.0
- name: Make changes
id: black
run: |
dos2unix --version
autopep8 --version
isort --version
black --version
find . -type f -not -path "./.git/*" -print0 | xargs -0 -n 1 -P 2 dos2unix # remove return
autopep8 --recursive --in-place --aggressive --aggressive --ignore E721 --max-line-length 200 .
isort .
black --skip-magic-trailing-comma .
git config --global user.name 'monai-bot'
git config --global user.email '[email protected]'
git add .
git diff --cached | cat
changes=
if [ -n "$(git status --porcelain)" ]; then
changes="true"
fi
echo "format=$changes" >> $GITHUB_OUTPUT
shell: bash
- name: Git commit
if: steps.black.outputs.format == 'true'
run: |
git commit -sam "[MONAI] code formatting"
git diff @~1
git checkout -b auto-update
git push -f --set-upstream origin auto-update
shell: bash
- name: Submit PR
if: steps.black.outputs.format == 'true'
run: |
gh pr create --fill --title "auto updates" --base main --head "auto-update"
env:
token: ${{ secrets.PR_MAINTAIN }}
GITHUB_TOKEN: ${{ secrets.PR_MAINTAIN }}