From d72b6c616c193c4663e7ef8de1fa81e84c9f4975 Mon Sep 17 00:00:00 2001 From: GlebRysev-UKKA Date: Tue, 17 Feb 2026 16:00:54 +0000 Subject: [PATCH 1/6] feat: action for creating automatic PRs for dependant repos --- .github/workflows/auto_dependency_pr.yml | 79 +++++++++++++++++++ .../auto_dependency_pr.properties.json | 4 + workflow-templates/auto_dependency_pr.yml | 34 ++++++++ 3 files changed, 117 insertions(+) create mode 100644 .github/workflows/auto_dependency_pr.yml create mode 100644 workflow-templates/auto_dependency_pr.properties.json create mode 100644 workflow-templates/auto_dependency_pr.yml diff --git a/.github/workflows/auto_dependency_pr.yml b/.github/workflows/auto_dependency_pr.yml new file mode 100644 index 0000000..7fb2ffa --- /dev/null +++ b/.github/workflows/auto_dependency_pr.yml @@ -0,0 +1,79 @@ +name: Sync PR to Main Repo + +on: + workflow_call: + inputs: + base_branch: + type: string + default: "main" + python_versions: + type: string + default: '["3.12"]' + target_repo: + type: string + default: "rr_validation" + +jobs: + update-main: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: ${{ fromJSON(inputs.python_versions) }} + + steps: + - name: Checkout package repo + uses: actions/checkout@v4 + + - name: Generate Token + uses: tibdex/github-app-token@v1 + id: generate-token + with: + app_id: ${{ secrets.REG_APP_ID }} + private_key: ${{ secrets.REG_APP_KEY }} + + - name: Checkout main repo + uses: actions/checkout@v4 + with: + repository: renalreg/${{ inputs.target_repo }} + token: ${{ steps.generate-token.outputs.token }} + path: ${{ inputs.target_repo }} + fetch-depth: 0 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: "${{ matrix.python-version }}" + + - name: Install Poetry + run: | + python -m pip install --upgrade pip + python -m pip install poetry + + - name: Authenticate GitHub HTTPS for private deps + run: | + git config --global url."https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com/".insteadOf "https://github.com/" + + - name: Update dependency (pin to PR SHA) and lock + run: | + cd ${{ inputs.target_repo }} + PR_SHA="${{ github.event.pull_request.head.sha }}" + SRC_REPO="${{ github.repository }}" + + poetry add --lock "git+https://github.com/${SRC_REPO}.git@${PR_SHA}" + + - name: Create or update PR in the main branch + uses: peter-evans/create-pull-request@v8 + with: + token: ${{ steps.generate-token.outputs.token }} + path: ${{ inputs.target_repo }} + base: ${{ inputs.base_branch }} + branch: bump-${{ github.event.repository.name }}-pr-${{ github.event.pull_request.number }} + commit-message: "Bump ${{ github.event.repository.name }} to PR #${{ github.event.pull_request.number }}" + title: "Test ${{ github.event.repository.name }} PR #${{ github.event.pull_request.number }}" + body: | + Auto-generated PR to test changes from: + ${{ github.event.pull_request.html_url }} + committer: bob-dependency-bot + author: bob-dependency-bot + reviewers: GlebRysev-UKKA diff --git a/workflow-templates/auto_dependency_pr.properties.json b/workflow-templates/auto_dependency_pr.properties.json new file mode 100644 index 0000000..01ff040 --- /dev/null +++ b/workflow-templates/auto_dependency_pr.properties.json @@ -0,0 +1,4 @@ +{ + "name": "UKKA Auto Dependency Pull Requests", + "description": "!!Experimental!! Automatically creates a pull request in another repo when PR is created in a current one." +} \ No newline at end of file diff --git a/workflow-templates/auto_dependency_pr.yml b/workflow-templates/auto_dependency_pr.yml new file mode 100644 index 0000000..2194b93 --- /dev/null +++ b/workflow-templates/auto_dependency_pr.yml @@ -0,0 +1,34 @@ + +name: Sync PR to Main Repo + +on: + pull_request: + # Fire when PR is opened and updated + types: [opened, synchronize, reopened] + + workflow_dispatch: + +jobs: + call-workflow: + name: Sync PR to Main Repo + if: ${{ !startsWith(github.head_ref, 'release-please--') }} + uses: renalreg/.github/.github/workflows/auto_dependency_pr.yml@main + secrets: inherit + + # # Optional configuration. + # # Uncomment and adjust as required. + # + # with: + # + # python_versions: '["3.10", "3.11"]' + # # Description: Python versions to test against + # # Default: lowest supported Python version + # + # + # base_branch: "main" + # # Description: Name of the base branch in target repo (generally main or master) + # # Default: "main" + + # target_repo: "rr_validation" + # # Description: Name of the target repo to create PR in (e.g. rr_validation) + # # Default: "rr_validation" From f84309a3d0bee6d8e44e6b5b92356e4727af19d1 Mon Sep 17 00:00:00 2001 From: GlebRysev-UKKA Date: Wed, 18 Feb 2026 09:44:22 +0000 Subject: [PATCH 2/6] feat: don't get triggered by dependabot --- .github/workflows/auto_dependency_pr.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/auto_dependency_pr.yml b/.github/workflows/auto_dependency_pr.yml index 7fb2ffa..9e62bfe 100644 --- a/.github/workflows/auto_dependency_pr.yml +++ b/.github/workflows/auto_dependency_pr.yml @@ -15,6 +15,11 @@ on: jobs: update-main: + if: >- + ${{ + github.actor != 'dependabot[bot]' && + github.event.pull_request.user.login != 'dependabot[bot]' + }} runs-on: ubuntu-latest strategy: From d989efac57f09062309344d74a0e332a00364112 Mon Sep 17 00:00:00 2001 From: GlebRysev-UKKA Date: Wed, 18 Feb 2026 09:57:49 +0000 Subject: [PATCH 3/6] feat: reviewers input --- .github/workflows/auto_dependency_pr.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/auto_dependency_pr.yml b/.github/workflows/auto_dependency_pr.yml index 9e62bfe..ed6738c 100644 --- a/.github/workflows/auto_dependency_pr.yml +++ b/.github/workflows/auto_dependency_pr.yml @@ -12,6 +12,9 @@ on: target_repo: type: string default: "rr_validation" + reviewers: + type: string + default: "" jobs: update-main: @@ -81,4 +84,4 @@ jobs: ${{ github.event.pull_request.html_url }} committer: bob-dependency-bot author: bob-dependency-bot - reviewers: GlebRysev-UKKA + reviewers: ${{ inputs.reviewers || '' }} From d1fdce4b47a4b34ef152da5e6b10b68e34d76d74 Mon Sep 17 00:00:00 2001 From: GlebRysev-UKKA Date: Wed, 18 Feb 2026 10:10:56 +0000 Subject: [PATCH 4/6] chore: better PR body --- .github/workflows/auto_dependency_pr.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto_dependency_pr.yml b/.github/workflows/auto_dependency_pr.yml index ed6738c..9a9ae16 100644 --- a/.github/workflows/auto_dependency_pr.yml +++ b/.github/workflows/auto_dependency_pr.yml @@ -78,10 +78,24 @@ jobs: base: ${{ inputs.base_branch }} branch: bump-${{ github.event.repository.name }}-pr-${{ github.event.pull_request.number }} commit-message: "Bump ${{ github.event.repository.name }} to PR #${{ github.event.pull_request.number }}" - title: "Test ${{ github.event.repository.name }} PR #${{ github.event.pull_request.number }}" + title: "Bump and test ${{ github.event.repository.name }} PR #${{ github.event.pull_request.number }}" body: | Auto-generated PR to test changes from: - ${{ github.event.pull_request.html_url }} + - Source PR: ${{ github.event.pull_request.html_url }} + - Source SHA: `${{ github.event.pull_request.head.sha }}` + - Package repo: `${{ github.repository }}` + + ## What this PR does + This PR pins `${{ github.event.repository.name }}` to the PR SHA above and updates `poetry.lock`. + + ## What to do next + 1. Review the dependencies + 2. Check the CI passes + 3. Pull locally and build/run + + ## How to merge + - Merge only after the source PR is approved and ready. + - Alternatively, close this PR once the source PR is merged. committer: bob-dependency-bot author: bob-dependency-bot reviewers: ${{ inputs.reviewers || '' }} From d4830202397d3d3da6956718f535315aba932770 Mon Sep 17 00:00:00 2001 From: GlebRysev-UKKA Date: Wed, 18 Feb 2026 10:21:40 +0000 Subject: [PATCH 5/6] docs: Auto Dependency PR docs --- README.md | 29 +++++++++++++++++++++++ workflow-templates/auto_dependency_pr.yml | 7 ++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 200b2c7..1722100 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ You can also copy and paste the templates into any repo you wish without the nee - **UKKA Python File Checker** - **UKKA Conventional PR Title** - **UKKA Auto Pull Requests** +- **UKKA Auto Dependency Pull Requests** @@ -178,6 +179,34 @@ Automates the creation and management of pull requests, including branch name ex - [**actions/checkout**](https://github.com/actions/checkout) - [**tibdex/github-app-token**](https://github.com/tibdex/github-app-token) + + +## Auto Dependency PR + +This action automates the creation of PR in repository B, whenever a PR is created in repository A, designed for cases when A is a dependency of B. Runs whenever a PR is opened or changed (e.g., has new commits added to it). + +**Example Options** + +```yaml +with: + + python_versions: '["3.10", "3.11"]' + # Description: Python versions to test against + # Default: lowest supported Python version + + base_branch: "main" + # Description: Name of the base branch in target repo (generally main or master) + # Default: "main" + + target_repo: "rr_validation" + # Description: Name of the target repo to create PR in (e.g. rr_validation) + # Default: "rr_validation" + + reviewers: "GlebRysev-UKKA" + # Description: GitHub username of a PR reviewer + # Default: "" (no reviewers) +``` + ## Python Test Gen A reusable workflow for running tests with configurable Python versions and OS matrix. Intended to be called by other workflows. diff --git a/workflow-templates/auto_dependency_pr.yml b/workflow-templates/auto_dependency_pr.yml index 2194b93..c5be059 100644 --- a/workflow-templates/auto_dependency_pr.yml +++ b/workflow-templates/auto_dependency_pr.yml @@ -24,11 +24,14 @@ jobs: # # Description: Python versions to test against # # Default: lowest supported Python version # - # # base_branch: "main" # # Description: Name of the base branch in target repo (generally main or master) # # Default: "main" - + # # target_repo: "rr_validation" # # Description: Name of the target repo to create PR in (e.g. rr_validation) # # Default: "rr_validation" + # + # reviewers: "GlebRysev-UKKA" + # # Description: GitHub username of a PR reviewer + # # Default: "" (no reviewers) \ No newline at end of file From 2dda227be535214952879eb839fd0bd536c77d79 Mon Sep 17 00:00:00 2001 From: GlebRysev-UKKA Date: Wed, 18 Feb 2026 10:56:47 +0000 Subject: [PATCH 6/6] fix: skip ci for the commit --- .github/workflows/auto_dependency_pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto_dependency_pr.yml b/.github/workflows/auto_dependency_pr.yml index 9a9ae16..4548bc2 100644 --- a/.github/workflows/auto_dependency_pr.yml +++ b/.github/workflows/auto_dependency_pr.yml @@ -77,7 +77,7 @@ jobs: path: ${{ inputs.target_repo }} base: ${{ inputs.base_branch }} branch: bump-${{ github.event.repository.name }}-pr-${{ github.event.pull_request.number }} - commit-message: "Bump ${{ github.event.repository.name }} to PR #${{ github.event.pull_request.number }}" + commit-message: "[skip ci] Bump ${{ github.event.repository.name }} to PR #${{ github.event.pull_request.number }}" title: "Bump and test ${{ github.event.repository.name }} PR #${{ github.event.pull_request.number }}" body: | Auto-generated PR to test changes from: @@ -90,7 +90,7 @@ jobs: ## What to do next 1. Review the dependencies - 2. Check the CI passes + 2. Run CI and check that it passes 3. Pull locally and build/run ## How to merge