Skip to content

feat: scaffold portablemc 5.x build and packaging #173

feat: scaffold portablemc 5.x build and packaging

feat: scaffold portablemc 5.x build and packaging #173

Workflow file for this run

name: Ruff Auto-Fix
on:
push:
paths:
- '**/*.py'
pull_request:
paths:
- '**/*.py'
permissions:
contents: write
pull-requests: write
jobs:
push-fix:
if: github.event_name == 'push' && !contains(join(github.event.commits.*.message, ' '), '[skip ci]')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Ruff
uses: astral-sh/ruff-action@v3
with:
version: "latest"
- name: Fix linting issues and format
run: |
ruff check --fix .
ruff format .
- name: Check for changes
id: git-check
run: |
git diff --quiet || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit and push if changed
if: steps.git-check.outputs.changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}
git add .
git commit -m "Apply automatic ruff fixes and formatting [skip ci]"
git push
pr-comment:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Ruff
uses: astral-sh/ruff-action@v3
with:
version: "latest"
- name: Fix linting issues and format
run: |
ruff check --fix .
ruff format .
- name: Check for changes
id: git-check
run: |
git diff --quiet || echo "changed=true" >> $GITHUB_OUTPUT
- name: Comment on PR if changed
if: steps.git-check.outputs.changed == 'true'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '⚠️ **Ruff auto-fix applied (changes detected)**\n\nLinting and formatting changes were found. Please run `ruff check --fix . && ruff format .` locally and push the changes, or let the push job handle it on the next commit.'
})