Skip to content

Commit

Permalink
Merge pull request #3 from gakki2019/main
Browse files Browse the repository at this point in the history
add workflow
  • Loading branch information
gakki2019 authored Feb 6, 2025
2 parents 3718ebe + 0610861 commit 448e1ad
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 26 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/auto_format_docs.yml
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
45 changes: 45 additions & 0 deletions .github/workflows/auto_format_python.yml
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
39 changes: 13 additions & 26 deletions .github/workflows/auto_release.yml
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:
Expand All @@ -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

0 comments on commit 448e1ad

Please sign in to comment.