-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
6 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,14 @@ | ||
name: Trigger lint format | ||
|
||
on: | ||
pull_request: | ||
types: [ labeled, opened, synchronize, reopened, review_requested ] | ||
issue_comment: | ||
types: [created] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
trigger: | ||
runs-on: ubuntu-latest | ||
name: Check for triggers | ||
outputs: | ||
head-ref: ${{ steps.comment-branch.outputs.head_ref }} | ||
head-repo: ${{ steps.comment-branch.outputs.head_owner }}/${{ steps.comment-branch.outputs.head_repo }} | ||
steps: | ||
- uses: KareemMAX/pull-request-comment-branch@head-repo-owner-release | ||
id: comment-branch | ||
|
||
format-code: | ||
needs: trigger | ||
name: Trigger lint bot | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Debug | ||
run: | | ||
echo "secrets.IVY_BRANCH_TOKEN: ${{ secrets.IVY_BRANCH_TOKEN }}" | ||
- name: Checkout ποΈ ${{ github.event.repository.name }} | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.trigger.outputs.head-ref }} | ||
repository: ${{ needs.trigger.outputs.head-repo }} | ||
token: ${{ secrets.IVY_BRANCH_TOKEN }} | ||
|
||
- name: Get changed files | ||
id: changed-files | ||
uses: KareemMAX/gh-action-get-changed-files@5a5ee034eff88bee239d4f49cd041fed0bec7480 | ||
with: | ||
token: ${{ secrets.IVY_BRANCH_TOKEN }} | ||
|
||
- name: Setup Python π | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
|
||
|
||
- name: Run pre-commit π | ||
continue-on-error: true | ||
uses: pre-commit/[email protected] | ||
with: | ||
extra_args: ${{ true && format('--files {0}', join(fromJSON(steps.changed-files.outputs.all), ' ')) || '--all-files' }} | ||
|
||
- name: Check if there are changes π | ||
id: check | ||
run: | | ||
if [[ -n "$(git status --porcelain)" ]]; then | ||
echo "changes=true" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Commit changes π | ||
if: steps.check.outputs.changes == 'true' | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "ivy-branch" | ||
git add . | ||
git commit -m "π€ Lint code" | ||
git push | ||
fix-linting: | ||
name: PR Lint Bot | ||
uses: unifyai/workflows/.github/workflows/pr-lint-bot.yml@main | ||
secrets: inherit |