Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix gha pre commit autoupdate #103

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions .github/workflows/pre-commit-autoupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,21 @@ jobs:
with:
fetch-depth: 0

- name: Update pre-commit
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Setup pre-commit
run: |
python -m pip install --upgrade pre-commit
pre-commit --version

- name: Run pre-commit autoupdate
id: autoupdate
run: |
echo "log<<EOF"
nox -v --session pre-commit autoupdate | tee -a >(cat >> $GITHUB_OUTPUT)
echo "log<<EOF" >>$GITHUB_OUTPUT
pre-commit autoupdate | tee -a >(cat >> $GITHUB_OUTPUT)
echo 'EOF' >> $GITHUB_OUTPUT

- name: Check diff
Expand All @@ -41,8 +51,21 @@ jobs:
run: |
set -xeu

git switch -c pre-commit-autoupdate
git add .
git config --global user.name "pre-commit autoupdate"
git config --global user.email "[email protected]"
git commit -m "pre-commit autoupdate"

git push --force --set-upstream origin pre-commit-autoupdate

title="pre-commit autoupdate"
body='```${{steps.autoupdate.output.log}}```'
body_file=/tmp/body
echo '```' >> $body_file
echo '$ pre-commit autoupdate' >> $body_file
echo '${{steps.autoupdate.outputs.log}}' >> $body_file
echo '```' >> $body_file
body="$(cat $body_file)"

pr_number=$(gh pr list -S "pre-commit autoupdate" --json number --jq '.[0].number')

Expand Down