forked from AXERA-TECH/pyaxengine
-
Notifications
You must be signed in to change notification settings - Fork 0
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
wanglusheng
committed
Feb 6, 2025
1 parent
ce0f2e2
commit 750b111
Showing
2 changed files
with
35 additions
and
47 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,4 +1,4 @@ | ||
name: Format Code | ||
name: Auto Format Config files & Docs | ||
|
||
on: | ||
push: | ||
|
@@ -11,34 +11,30 @@ on: | |
jobs: | ||
format: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout code | ||
- if: github.event_name == 'push' | ||
uses: actions/checkout@v2 | ||
- if: github.event_name == 'pull_request' | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "16" | ||
|
||
- name: Install Prettier | ||
run: | | ||
npm install --save-dev prettier | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Format YAML and Markdown files | ||
run: | | ||
npx prettier --write "**/*.yml" "**/*.md" | ||
- name: Check for changes | ||
id: check_changes | ||
run: | | ||
git diff --exit-code || echo "Changes detected" | ||
- name: Run Black | ||
uses: actionsx/prettier@v2 | ||
with: | ||
# prettier CLI arguments. | ||
args: --write "**/*.yml" "**/*.md" | ||
|
||
- name: Commit changes | ||
if: steps.check_changes.outputs.exit_code != 0 | ||
run: | | ||
git config --local user.name "github-actions" | ||
git config --local user.email "[email protected]" | ||
git add . | ||
git commit -m "Format YAML and Markdown files with Prettier" || echo "No changes to commit" | ||
git push | ||
id: commit_changes | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
commit-message: format & update for python | ||
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | ||
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> | ||
signoff: false | ||
delete-branch: true |
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 |
---|---|---|
|
@@ -11,35 +11,27 @@ on: | |
jobs: | ||
format: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout code | ||
- if: github.event_name == 'push' | ||
uses: actions/checkout@v2 | ||
- if: github.event_name == 'pull_request' | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.8" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install black | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Run Black | ||
run: | | ||
black . | ||
- name: Check for changes | ||
id: check_changes | ||
run: | | ||
git diff --exit-code || echo "Changes detected" | ||
uses: datadog/action-py-black-formatter@v2 | ||
|
||
- name: Commit changes | ||
if: steps.check_changes.outputs.exit_code != 0 | ||
run: | | ||
git config --local user.name "github-actions" | ||
git config --local user.email "[email protected]" | ||
git add . | ||
git commit -m "Format Python code with Black" || echo "No changes to commit" | ||
git push | ||
id: commit_changes | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
commit-message: format & update for python | ||
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | ||
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> | ||
signoff: false | ||
delete-branch: true |