Skip to content

Commit 6bb9367

Browse files
authored
Merge pull request #277 from xylar/fix-update-pre-commit-workflow
Switch pre-commit update workflow to use conda
2 parents bd37c3a + dd9dd7f commit 6bb9367

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

.github/workflows/pre_commit_update_workflow.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
# 4. Entry: Month of the year when the process will be started [1-12]
1010
# 5. Entry: Weekday when the process will be started [0-6] [0 is Sunday]
1111
- cron: '0 8 * * 3'
12+
# Allow manual triggering of the workflow
13+
workflow_dispatch:
1214

1315
env:
1416
UP_TO_DATE: false
@@ -20,16 +22,30 @@ jobs:
2022
steps:
2123
- uses: actions/checkout@v4
2224

23-
- name: Set up Python
24-
uses: actions/setup-python@v5
25+
- name: Set up Conda Environment
26+
uses: mamba-org/setup-micromamba@v2
2527
with:
26-
python-version: ${{ env.PYTHON_VERSION }}
28+
environment-name: pre_commit_dev
29+
init-shell: bash
30+
condarc: |
31+
channel_priority: strict
32+
channels:
33+
- conda-forge
34+
create-args: >-
35+
python=${{ env.PYTHON_VERSION }}
2736
28-
- name: Install pre-commit
29-
run: pip install pre-commit
37+
- name: Install pre-commit and gh
38+
run: |
39+
eval "$(micromamba shell hook --shell bash)"
40+
micromamba activate pre_commit_dev
41+
# permissions issue with gh 2.76.0
42+
conda install -y pre-commit "gh !=2.76.0"
43+
gh --version
3044
3145
- name: Apply and commit updates
3246
run: |
47+
eval "$(micromamba shell hook --shell bash)"
48+
micromamba activate pre_commit_dev
3349
git clone https://github.com/E3SM-Project/mache.git update-pre-commit-deps
3450
cd update-pre-commit-deps
3551
# Configure git using GitHub Actions credentials.
@@ -55,12 +71,14 @@ jobs:
5571
- name: Make PR and add reviewers and labels
5672
if: ${{ env.UP_TO_DATE == 'false' }}
5773
run: |
74+
eval "$(micromamba shell hook --shell bash)"
75+
micromamba activate pre_commit_dev
5876
cd update-pre-commit-deps
5977
gh pr create \
6078
--title "Update pre-commit and its dependencies" \
6179
--body "This PR was auto-generated to update pre-commit and its dependencies." \
6280
--head update-pre-commit-deps \
63-
--reviewer altheaden,xylar \
81+
--reviewer altheaden,xylar,andrewdnolan \
6482
--label ci
6583
env:
6684
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)