-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from gakki2019/main
add workflow
- Loading branch information
Showing
3 changed files
with
102 additions
and
26 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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Format Code | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
format: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
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 | ||
- 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: 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 |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Auto Format Python Code with Black | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
format: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install black | ||
- name: Run Black | ||
run: | | ||
black . | ||
- name: Check for changes | ||
id: check_changes | ||
run: | | ||
git diff --exit-code || echo "Changes detected" | ||
- 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 |
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,15 +1,11 @@ | ||
name: Auto Format Python Code with Black | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
format: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
@@ -21,25 +17,16 @@ jobs: | |
with: | ||
python-version: "3.9" | ||
|
||
- name: Install dependencies | ||
- name: Install build dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install black | ||
python -m pip install --upgrade pip setuptools wheel | ||
- name: Run Black | ||
- name: Build the package | ||
run: | | ||
black . | ||
python setup.py bdist_wheel | ||
- name: Check for changes | ||
id: check_changes | ||
run: | | ||
git diff --exit-code || echo "Changes detected" | ||
- 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 | ||
- name: Upload the package | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package | ||
path: dist/*.whl |