diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..d8b18a44 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,21 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "daily" + groups: + dependencies: + patterns: + - "*" + open-pull-requests-limit: 10 + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + groups: + dependencies: + patterns: + - "*" + open-pull-requests-limit: 10 diff --git a/.github/workflows/push_gh-deploy.yml b/.github/workflows/push_gh-deploy.yml index ed630e62..201ccc6b 100644 --- a/.github/workflows/push_gh-deploy.yml +++ b/.github/workflows/push_gh-deploy.yml @@ -3,9 +3,19 @@ name: ci on: + # 直接プッシュ時([skip ci]がないもの) push: branches: - main + # 他のワークフローの完了時 + workflow_run: + workflows: + - "Update pre-commit Hooks" + - "Update Requirements after Dependabot Merge" + types: + - completed + branches: + - main env: cache_id: "" @@ -15,6 +25,8 @@ permissions: jobs: deploy: + # 条件分岐の整理 + if: (github.event_name == 'push' && !contains(github.event.head_commit.message, '[skip ci]')) || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -34,10 +46,3 @@ jobs: run: poetry install - name: Deploy GitHub Pages run: poetry run mkdocs gh-deploy --force - #- run: | - # pip install mkdocs-material \ - # mkdocs-static-i18n \ - # pygments \ - # plantuml-markdown \ - # mkdocs-glightbox - #- run: mkdocs gh-deploy --force diff --git a/.github/workflows/update_pre-commit_hooks.yml b/.github/workflows/update_pre-commit_hooks.yml new file mode 100644 index 00000000..1111d72c --- /dev/null +++ b/.github/workflows/update_pre-commit_hooks.yml @@ -0,0 +1,51 @@ +name: Update pre-commit Hooks + +on: + schedule: + - cron: "0 0 * * 5" + workflow_dispatch: + +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + token: ${{ secrets.PAT_FOR_PUSHES }} + - name: Set up Python + uses: actions/setup-python@v5.3.0 + with: + python-version: "3.13" + - name: Install poetry + run: pip install poetry + - name: Cache dependencies + uses: actions/cache@v4.1.2 + with: + path: ~/.cache/pypoetry + key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} + - name: Install dependencies + run: poetry install + + # Update pre-commit hooks and check for changes + - name: Update pre-commit hooks + id: update_hooks + run: | + poetry run pre-commit autoupdate + if git diff --exit-code .pre-commit-config.yaml; then + echo "has_updates=false" >> "$GITHUB_OUTPUT" + echo "No updates to pre-commit hooks. Exiting workflow." + else + echo "has_updates=true" >> "$GITHUB_OUTPUT" + fi + + # Commit/push + - name: Commit changes + if: steps.update_hooks.outputs.has_updates == 'true' + shell: bash + run: | + git config --local user.email "33836132+github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git add .pre-commit-config.yaml + git commit -m ":arrow_up: Update pre-commit hooks [skip ci]" || echo "No changes to commit" + git push diff --git a/.github/workflows/update_requirements_after_dependabot.yml b/.github/workflows/update_requirements_after_dependabot.yml new file mode 100644 index 00000000..e03ba780 --- /dev/null +++ b/.github/workflows/update_requirements_after_dependabot.yml @@ -0,0 +1,42 @@ +name: Update Requirements after Dependabot Merge + +# ワークフローの処理の流れ: +# 1. トリガー条件: +# - プルリクエストマージ時 +# - Dependabotによる実行であること +# 2. 環境のセットアップ(Ubuntu、Python、Poetry) +# 3. requirements.txtとrequirements-dev.txtの作成 +# 4. 変更のコミットとプッシュ + +on: + pull_request: + types: [closed] + +jobs: + update-requirements: + if: github.event.pull_request.merged == true && github.event.pull_request.user.login == 'dependabot[bot]' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + token: ${{ secrets.PAT_FOR_PUSHES }} + - name: Set up Python + uses: actions/setup-python@v5.3.0 + with: + python-version: "3.13" + - name: Install Poetry + run: pip install poetry + - name: Install dependencies + run: poetry install + - name: Update requirements files + run: | + poetry export -f requirements.txt -o requirements.txt --without-hashes + poetry export -f requirements.txt -o requirements-dev.txt --without-hashes --with dev + - name: Commit and push changes + run: | + git config --local user.email "33836132+github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git add requirements.txt requirements-dev.txt + git commit -m ":wrench:Update requirements files after dependency update [skip ci]" || echo "No changes to commit" + git push diff --git a/.github/workflows/update_version_and_release.yml b/.github/workflows/update_version_and_release.yml new file mode 100644 index 00000000..54dde6dd --- /dev/null +++ b/.github/workflows/update_version_and_release.yml @@ -0,0 +1,87 @@ +name: Version Update and Release + +# Workflow Process Flow: +# 1. Trigger Conditions: +# - Manual execution (workflow_dispatch) +# 2. Environment Setup (Ubuntu, Python, Poetry) +# 3. Retrieve the current version +# 4. Update to the new version (patch, minor, or major) +# 5. Commit and push the changes +# 6. Create and push a new tag +# 7. Generate the changelog +# 8. Create a GitHub release + +on: + workflow_dispatch: + inputs: + update_type: + description: "Type of version update" + required: true + default: "patch" + type: choice + options: + - patch + - minor + - major + +jobs: + update-version-and-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + token: ${{ secrets.PAT_FOR_PUSHES }} + - name: Set up Python + uses: actions/setup-python@v5.3.0 + with: + python-version: "3.13" + - name: Install poetry + run: | + python -m pip install --upgrade pip + pip install poetry + - name: Configure Git + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + - name: Get current version + id: current_version + run: echo "version=$(poetry version -s)" >> "$GITHUB_OUTPUT" + - name: Update version + id: update_version + run: | + poetry version ${{ github.event.inputs.update_type }} + echo "new_version=$(poetry version -s)" >> "$GITHUB_OUTPUT" + - name: Commit and push if changed + run: | + git add pyproject.toml + git commit -m ":wrench:Bump version to ${{ steps.update_version.outputs.new_version }}" || echo "No changes to commit" + git push + - name: Create and push new tag + run: | + git tag v${{ steps.update_version.outputs.new_version }} + git push --tags + - name: Generate changelog + id: changelog + run: | + changelog=$(git log --pretty=format:"- %s" v${{ steps.current_version.outputs.version }}..v${{ steps.update_version.outputs.new_version }}) + { + echo "changelog<> "$GITHUB_OUTPUT" + - name: Create Release + uses: softprops/action-gh-release@v2.1.0 + with: + tag_name: v${{ steps.update_version.outputs.new_version }} + name: repo-dispatch-event-sender-v${{ steps.update_version.outputs.new_version }} + body: | + ## Changes in this Release + + ${{ steps.changelog.outputs.changelog }} + + For full changes, see the [comparison view](${{ github.server_url }}/${{ github.repository }}/compare/v${{ steps.current_version.outputs.version }}..v${{ steps.update_version.outputs.new_version }}) + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.PAT_FOR_PUSHES }} diff --git a/poetry.lock b/poetry.lock index fe90ab31..0c484246 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.5 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.0 and should not be changed by hand. [[package]] name = "babel" @@ -1167,29 +1167,29 @@ files = [ [[package]] name = "ruff" -version = "0.8.5" +version = "0.8.6" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.8.5-py3-none-linux_armv6l.whl", hash = "sha256:5ad11a5e3868a73ca1fa4727fe7e33735ea78b416313f4368c504dbeb69c0f88"}, - {file = "ruff-0.8.5-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:f69ab37771ea7e0715fead8624ec42996d101269a96e31f4d31be6fc33aa19b7"}, - {file = "ruff-0.8.5-py3-none-macosx_11_0_arm64.whl", hash = "sha256:b5462d7804558ccff9c08fe8cbf6c14b7efe67404316696a2dde48297b1925bb"}, - {file = "ruff-0.8.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d56de7220a35607f9fe59f8a6d018e14504f7b71d784d980835e20fc0611cd50"}, - {file = "ruff-0.8.5-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9d99cf80b0429cbebf31cbbf6f24f05a29706f0437c40413d950e67e2d4faca4"}, - {file = "ruff-0.8.5-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7b75ac29715ac60d554a049dbb0ef3b55259076181c3369d79466cb130eb5afd"}, - {file = "ruff-0.8.5-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:c9d526a62c9eda211b38463528768fd0ada25dad524cb33c0e99fcff1c67b5dc"}, - {file = "ruff-0.8.5-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:587c5e95007612c26509f30acc506c874dab4c4abbacd0357400bd1aa799931b"}, - {file = "ruff-0.8.5-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:622b82bf3429ff0e346835ec213aec0a04d9730480cbffbb6ad9372014e31bbd"}, - {file = "ruff-0.8.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f99be814d77a5dac8a8957104bdd8c359e85c86b0ee0e38dca447cb1095f70fb"}, - {file = "ruff-0.8.5-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:c01c048f9c3385e0fd7822ad0fd519afb282af9cf1778f3580e540629df89725"}, - {file = "ruff-0.8.5-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:7512e8cb038db7f5db6aae0e24735ff9ea03bb0ed6ae2ce534e9baa23c1dc9ea"}, - {file = "ruff-0.8.5-py3-none-musllinux_1_2_i686.whl", hash = "sha256:762f113232acd5b768d6b875d16aad6b00082add40ec91c927f0673a8ec4ede8"}, - {file = "ruff-0.8.5-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:03a90200c5dfff49e4c967b405f27fdfa81594cbb7c5ff5609e42d7fe9680da5"}, - {file = "ruff-0.8.5-py3-none-win32.whl", hash = "sha256:8710ffd57bdaa6690cbf6ecff19884b8629ec2a2a2a2f783aa94b1cc795139ed"}, - {file = "ruff-0.8.5-py3-none-win_amd64.whl", hash = "sha256:4020d8bf8d3a32325c77af452a9976a9ad6455773bcb94991cf15bd66b347e47"}, - {file = "ruff-0.8.5-py3-none-win_arm64.whl", hash = "sha256:134ae019ef13e1b060ab7136e7828a6d83ea727ba123381307eb37c6bd5e01cb"}, - {file = "ruff-0.8.5.tar.gz", hash = "sha256:1098d36f69831f7ff2a1da3e6407d5fbd6dfa2559e4f74ff2d260c5588900317"}, + {file = "ruff-0.8.6-py3-none-linux_armv6l.whl", hash = "sha256:defed167955d42c68b407e8f2e6f56ba52520e790aba4ca707a9c88619e580e3"}, + {file = "ruff-0.8.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:54799ca3d67ae5e0b7a7ac234baa657a9c1784b48ec954a094da7c206e0365b1"}, + {file = "ruff-0.8.6-py3-none-macosx_11_0_arm64.whl", hash = "sha256:e88b8f6d901477c41559ba540beeb5a671e14cd29ebd5683903572f4b40a9807"}, + {file = "ruff-0.8.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0509e8da430228236a18a677fcdb0c1f102dd26d5520f71f79b094963322ed25"}, + {file = "ruff-0.8.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:91a7ddb221779871cf226100e677b5ea38c2d54e9e2c8ed847450ebbdf99b32d"}, + {file = "ruff-0.8.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:248b1fb3f739d01d528cc50b35ee9c4812aa58cc5935998e776bf8ed5b251e75"}, + {file = "ruff-0.8.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:bc3c083c50390cf69e7e1b5a5a7303898966be973664ec0c4a4acea82c1d4315"}, + {file = "ruff-0.8.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:52d587092ab8df308635762386f45f4638badb0866355b2b86760f6d3c076188"}, + {file = "ruff-0.8.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:61323159cf21bc3897674e5adb27cd9e7700bab6b84de40d7be28c3d46dc67cf"}, + {file = "ruff-0.8.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7ae4478b1471fc0c44ed52a6fb787e641a2ac58b1c1f91763bafbc2faddc5117"}, + {file = "ruff-0.8.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:0c000a471d519b3e6cfc9c6680025d923b4ca140ce3e4612d1a2ef58e11f11fe"}, + {file = "ruff-0.8.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:9257aa841e9e8d9b727423086f0fa9a86b6b420fbf4bf9e1465d1250ce8e4d8d"}, + {file = "ruff-0.8.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:45a56f61b24682f6f6709636949ae8cc82ae229d8d773b4c76c09ec83964a95a"}, + {file = "ruff-0.8.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:496dd38a53aa173481a7d8866bcd6451bd934d06976a2505028a50583e001b76"}, + {file = "ruff-0.8.6-py3-none-win32.whl", hash = "sha256:e169ea1b9eae61c99b257dc83b9ee6c76f89042752cb2d83486a7d6e48e8f764"}, + {file = "ruff-0.8.6-py3-none-win_amd64.whl", hash = "sha256:f1d70bef3d16fdc897ee290d7d20da3cbe4e26349f62e8a0274e7a3f4ce7a905"}, + {file = "ruff-0.8.6-py3-none-win_arm64.whl", hash = "sha256:7d7fc2377a04b6e04ffe588caad613d0c460eb2ecba4c0ccbbfe2bc973cbc162"}, + {file = "ruff-0.8.6.tar.gz", hash = "sha256:dcad24b81b62650b0eb8814f576fc65cfee8674772a6e24c9b747911801eeaa5"}, ] [[package]] diff --git a/requirements-dev.txt b/requirements-dev.txt index 6126336f..0c82698b 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -49,7 +49,7 @@ regex==2024.11.6 ; python_version >= "3.10" and python_version < "4.0" requests==2.32.3 ; python_version >= "3.10" and python_version < "4.0" ruamel-yaml-clib==0.2.12 ; platform_python_implementation == "CPython" and python_version < "3.13" and python_version >= "3.10" ruamel-yaml==0.17.40 ; python_version >= "3.10" and python_version < "4.0" -ruff==0.8.5 ; python_version >= "3.10" and python_version < "4.0" +ruff==0.8.6 ; python_version >= "3.10" and python_version < "4.0" six==1.17.0 ; python_version >= "3.10" and python_version < "4.0" taskipy==1.14.1 ; python_version >= "3.10" and python_version < "4.0" tomli==2.2.1 ; python_version >= "3.10" and python_version < "4.0"