From 9d4a69004105e4590234d115f0736a413a91362b Mon Sep 17 00:00:00 2001 From: Mikita Sakalouski <38785549+mikita-sakalouski@users.noreply.github.com> Date: Thu, 30 May 2024 00:58:49 +0200 Subject: [PATCH 1/6] Create dependabot.yml --- .github/dependabot.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..4011677a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly From 3f1d26f92f2bbf14dc4c7d216d8304ff32099cd4 Mon Sep 17 00:00:00 2001 From: Mikita Sakalouski <38785549+mikita-sakalouski@users.noreply.github.com> Date: Thu, 30 May 2024 10:42:59 +0200 Subject: [PATCH 2/6] fix: imporve workflow --- .github/workflows/test.yaml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 240ccc5e..d9f381a1 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -29,7 +29,23 @@ env: FORCE_COLOR: "1" jobs: + check_changes: + runs-on: ubuntu-latest + outputs: + python_changed: ${{ steps.check.outputs.python_changed }} + toml_changed: ${{ steps.check.outputs.toml_changed }} + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Check changes + id: check + run: | + echo "::set-output name=python_changed::$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep '\.py$')" + echo "::set-output name=toml_changed::$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep '\.toml$')" + tests: + needs: check_changes + if: needs.check_changes.outputs.python_changed != '' || needs.check_changes.outputs.toml_changed != '' name: Python ${{ matrix.python-version }} with PySpark ${{ matrix.pyspark-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} runs-on: ${{ matrix.os }} @@ -75,6 +91,7 @@ jobs: if: always() needs: + - check_changes - tests runs-on: ubuntu-latest @@ -83,4 +100,5 @@ jobs: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@release/v1 with: - jobs: ${{ toJSON(needs) }} \ No newline at end of file + jobs: ${{ toJSON(needs) }} + allowed-skips: tests \ No newline at end of file From 198f57f7acd1df382d318e1da686f918c5563b78 Mon Sep 17 00:00:00 2001 From: Mikita Sakalouski <38785549+mikita-sakalouski@users.noreply.github.com> Date: Thu, 30 May 2024 10:43:56 +0200 Subject: [PATCH 3/6] feat: Remove unnecessary file paths from pull request trigger --- .github/workflows/test.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d9f381a1..dce3fac0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,9 +4,6 @@ on: pull_request: branches: - main - paths: - - '**.py' - - '**.toml' workflow_dispatch: inputs: logLevel: From 62b1192ff0a8af4014b21d4191f65d98ec23cda9 Mon Sep 17 00:00:00 2001 From: Mikita Sakalouski <38785549+mikita-sakalouski@users.noreply.github.com> Date: Thu, 30 May 2024 10:50:56 +0200 Subject: [PATCH 4/6] fix: switch to GITHUB_OUTPUT --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index dce3fac0..8ccd6986 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -37,8 +37,8 @@ jobs: - name: Check changes id: check run: | - echo "::set-output name=python_changed::$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep '\.py$')" - echo "::set-output name=toml_changed::$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep '\.toml$')" + echo "python_changed=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep '\.py$')" >> "$GITHUB_OUTPUT" + echo "toml_changed=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep '\.toml$')" >> "$GITHUB_OUTPUT" tests: needs: check_changes From 078ef7dce8500d2c2fabaaf8e592331f2e1aee55 Mon Sep 17 00:00:00 2001 From: Mikita Sakalouski <38785549+mikita-sakalouski@users.noreply.github.com> Date: Thu, 30 May 2024 16:27:29 +0200 Subject: [PATCH 5/6] chore: Update test.yaml to include run-name for pull requests --- .github/workflows/test.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8107c8e0..c19a130e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,4 +1,6 @@ name: Test +run-name: ${{ 'Tests for PR ' }}${{ github.event.pull_request.number }}${{ ' by ' }}${{ github.event.pull_request.user.login }} + on: pull_request: From 070cce3a6530ac239b55e4f8ced7fbec2f8ce88e Mon Sep 17 00:00:00 2001 From: Mikita Sakalouski <38785549+mikita-sakalouski@users.noreply.github.com> Date: Thu, 30 May 2024 17:30:42 +0200 Subject: [PATCH 6/6] fix: add github action --- .github/workflows/auto-merge-dependabot.yml | 51 +++++++++++++++++++++ .github/workflows/{test.yaml => test.yml} | 0 README.md | 2 +- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/auto-merge-dependabot.yml rename .github/workflows/{test.yaml => test.yml} (100%) diff --git a/.github/workflows/auto-merge-dependabot.yml b/.github/workflows/auto-merge-dependabot.yml new file mode 100644 index 00000000..170f35f3 --- /dev/null +++ b/.github/workflows/auto-merge-dependabot.yml @@ -0,0 +1,51 @@ +name: Auto Merge Dependabot PRs + +on: + pull_request_target: + types: + - opened + - reopened + - synchronize + branches: + - main + +permissions: + contents: write + pull-requests: write + +jobs: + dependabot: + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' + + steps: + - name: Wait all checks + uses: lewagon/wait-on-check-action@v1.3.4 + with: + ref: ${{ github.ref }} + check-name: final_check + wait-interval: 10 + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v2 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + + - name: Add a label for all production dependencies + if: steps.metadata.outputs.dependency-type == 'direct:production' + run: gh pr edit "$PR_URL" --add-label "production" + env: + PR_URL: ${{github.event.pull_request.html_url}} + + - name: Enable auto-merge for Dependabot PRs + # steps.dependabot-metadata.outputs.update-type: + # The highest semver change being made by this PR, + # e.g. version-update:semver-major. + # For all possible values, see the ignore documentation. + # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#ignore + if: steps.metadata.outputs.update-type == 'version-update:semver-patch' + run: gh pr merge --auto --squash ${{ github.event.pull_request.html_url }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yml similarity index 100% rename from .github/workflows/test.yaml rename to .github/workflows/test.yml diff --git a/README.md b/README.md index 7ee2dbd6..23454f8b 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ | | | |---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| CI/CD | [![CI - Test](https://github.com/Nike-Inc/koheesio/actions/workflows/test.yaml/badge.svg)](https://github.com/Nike-Inc/koheesio/actions/workflows/test.yaml) [![CD - Release Koheesio](https://github.com/Nike-Inc/koheesio/actions/workflows/release.yml/badge.svg)](https://github.com/Nike-Inc/koheesio/actions/workflows/release.yml) | +| CI/CD | [![CI - Test](https://github.com/Nike-Inc/koheesio/actions/workflows/test.yml/badge.svg)](https://github.com/Nike-Inc/koheesio/actions/workflows/test.yml) [![CD - Release Koheesio](https://github.com/Nike-Inc/koheesio/actions/workflows/release.yml/badge.svg)](https://github.com/Nike-Inc/koheesio/actions/workflows/release.yml) | | Package | [![PyPI - Version](https://img.shields.io/pypi/v/koheesio.svg?logo=pypi&label=PyPI&logoColor=gold)](https://pypi.org/project/koheesio/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/koheesio.svg?logo=python&label=Python&logoColor=gold)](https://pypi.org/project/koheesio/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/koheesio?color=blue&label=Installs&logo=pypi&logoColor=gold)](https://pypi.org/project/koheesio/) | | Meta | [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![types - Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/python/mypy) [![docstring - numpydoc](https://img.shields.io/badge/docstring-numpydoc-blue)](https://numpydoc.readthedocs.io/en/latest/format.html) [![code style - black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![License - Apache 2.0](https://img.shields.io/github/license/Nike-Inc/koheesio)](LICENSE.txt) |