Skip to content

Commit

Permalink
Move suggest fixes to a separate CI workflow (#6455)
Browse files Browse the repository at this point in the history
Move suggest fixes to a separate CI workflow so that it is triggered
only on PRs and does not fail the main branch.

Signed-off-by: Justin Chu <justinchu@microsoft.com>
  • Loading branch information
justinchuby authored Oct 15, 2024
1 parent 2b504f8 commit 1e3be88
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 25 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,28 +121,3 @@ jobs:
exit 1
fi
echo -e "::endgroup::"
auto-apply-fixes:
name: Suggest fixes
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install -r requirements-dev.txt
lintrunner init
- name: Run lintrunner on all files
run: |
set +e
lintrunner f --all-files -v
exit 0
- uses: parkerbxyz/suggest-changes@v1
with:
comment: 'You can commit the suggested changes from lintrunner.'
43 changes: 43 additions & 0 deletions .github/workflows/pr_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0

name: PR Checks

on:
pull_request:
branches:
- main

permissions: # set top-level default permissions as security best practice
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true

jobs:
auto-apply-fixes:
name: Suggest fixes
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install -r requirements-dev.txt
lintrunner init
- name: Run lintrunner on all files
run: |
set +e
lintrunner f --all-files -v
exit 0
- uses: parkerbxyz/suggest-changes@v1
with:
comment: 'You can commit the suggested changes from lintrunner.'

0 comments on commit 1e3be88

Please sign in to comment.