@@ -21,32 +21,18 @@ jobs:
2121 auto-update :
2222 runs-on : ubuntu-latest
2323 steps :
24- - uses : actions/checkout@v5
24+ - uses : actions/checkout@v4
2525
26- - name : Set up Conda Environment
27- uses : mamba-org /setup-micromamba@v2
26+ - name : Set up Python
27+ uses : actions /setup-python@v5
2828 with :
29- environment-name : pre_commit_dev
30- init-shell : bash
31- condarc : |
32- channel_priority: strict
33- channels:
34- - conda-forge
35- create-args : >-
36- python=${{ env.PYTHON_VERSION }}
29+ python-version : ${{ env.PYTHON_VERSION }}
3730
38- - name : Install pre-commit and gh
39- run : |
40- eval "$(micromamba shell hook --shell bash)"
41- micromamba activate pre_commit_dev
42- # permissions issue with gh 2.76.0
43- conda install -y pre-commit "gh !=2.76.0"
44- gh --version
31+ - name : Install pre-commit
32+ run : pip install pre-commit
4533
4634 - name : Apply and commit updates
4735 run : |
48- eval "$(micromamba shell hook --shell bash)"
49- micromamba activate pre_commit_dev
5036 git clone https://github.com/E3SM-Project/mache.git update-pre-commit-deps
5137 cd update-pre-commit-deps
5238 # Configure git using GitHub Actions credentials.
5844 # The second command will fail if no changes were present, so we ignore it
5945 git commit -m "Update pre-commit dependencies" || ( echo "UP_TO_DATE=true" >> "$GITHUB_ENV")
6046
61- - name : Push Changes
47+ - name : Push Changes with github-actions bot
6248 if : ${{ env.UP_TO_DATE == 'false' }}
6349 uses : ad-m/github-push-action@master
6450 with :
@@ -69,12 +55,14 @@ jobs:
6955 env :
7056 GH_TOKEN : ${{ github.token }}
7157
72- - name : Make PR and add reviewers and labels
58+ - name : Create PR with github-actions bot
7359 if : ${{ env.UP_TO_DATE == 'false' }}
7460 run : |
75- eval "$(micromamba shell hook --shell bash)"
76- micromamba activate pre_commit_dev
7761 cd update-pre-commit-deps
62+ # Close any existing PR and replace with most up-to-date changes
63+ gh pr close update-pre-commit-deps \
64+ --comment "This PR was closed to create a new, updated PR." || \
65+ echo "No existing PR to close and replace."
7866 gh pr create \
7967 --title "Update pre-commit and its dependencies" \
8068 --body "This PR was auto-generated to update pre-commit and its dependencies." \
8472 env :
8573 GH_TOKEN : ${{ github.token }}
8674
75+ - name : Add reviewers and labels with PAT
76+ if : ${{ env.UP_TO_DATE == 'false' }}
77+ run : |
78+ cd update-pre-commit-deps
79+
80+ gh pr edit --add-label ci
81+
82+ IFS=',' read -ra reviewers <<< "${REVIEWERS}"
83+ for reviewer in "${reviewers[@]}"; do
84+ echo "Adding reviewer: $reviewer"
85+ gh pr edit --add-reviewer "$reviewer"
86+ done
87+
88+ env :
89+ REVIEWERS : ${{ env.REVIEWERS }}
90+ GH_TOKEN : ${{ secrets.GH_CLI_TOKEN }}
0 commit comments