Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 58 additions & 50 deletions .github/workflows/merge-bot-pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,58 @@
name: Merge bot pull request action

on:
pull_request:
types: [opened, reopened, synchronize]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

merge-dependabot:
name: Merge dependabot pull request job
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository
permissions:
contents: write
pull-requests: write

steps:

- name: Get dependabot metadata step
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Merge pull request step
if: steps.metadata.outputs.update-type != 'version-update:semver-major'
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

merge-codegen:
name: Merge codegen pull request job
runs-on: ubuntu-latest
if: github.actor == 'ptr727' && github.event.pull_request.user.login == 'ptr727' && github.event.pull_request.head.ref == 'codegen' && github.event.pull_request.base.ref == 'main' && github.event.pull_request.head.repo.full_name == github.repository
permissions:
contents: write
pull-requests: write

steps:

- name: Merge pull request step
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
name: Merge bot pull request action

on:
pull_request:
types: [opened, reopened, synchronize]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

merge-dependabot:
name: Merge dependabot pull request job
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository
permissions:
contents: write
pull-requests: write

steps:

- name: Get dependabot metadata step
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Merge pull request step
if: steps.metadata.outputs.update-type != 'version-update:semver-major'
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

merge-codegen:
name: Merge codegen pull request job
runs-on: ubuntu-latest
if: >-
github.event.pull_request.user.login == 'github-actions[bot]' &&
github.event.pull_request.head.ref == 'codegen' &&
github.event.pull_request.base.ref == 'main' &&
github.event.pull_request.head.repo.full_name == github.repository &&
(
(github.event.action == 'reopened' && github.actor == github.repository_owner) ||
(github.event.action != 'reopened' && github.actor == 'github-actions[bot]')
)
permissions:
contents: write
pull-requests: write

steps:

- name: Merge pull request step
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
114 changes: 65 additions & 49 deletions .github/workflows/run-codegen-pull-request-task.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,65 @@
name: Run codegen and pull request task

on:
workflow_call:
secrets:
WORKFLOW_PAT:
required: true

jobs:

codegen:
name: Run codegen and pull request job
runs-on: ubuntu-latest

steps:

- name: Setup .NET SDK step
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x

- name: Checkout code step
uses: actions/checkout@v6
with:
ref: main

- name: Run codegen step
run: |
dotnet run --project ./CreateMatrix/CreateMatrix.csproj -- \
matrix --versionpath=./Make/Version.json --matrixpath=./Make/Matrix.json --updateversion

- name: Format code step
run: |
dotnet tool restore
dotnet husky install
dotnet csharpier format --log-level=debug .
git status

- name: Create pull request step
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.WORKFLOW_PAT }}
base: main
branch: codegen
title: 'Update codegen files'
body: 'This PR updates the codegen files.'
commit-message: 'Update codegen files'
delete-branch: true
sign-commits: true
name: Run codegen and pull request task

on:
workflow_call:
secrets:
Comment thread
ptr727 marked this conversation as resolved.
Resolved
# Least-privilege PAT used by `gh pr close/reopen` to re-trigger PR workflows.
# Grant only the minimum repository permissions needed to modify PR state
# (typically pull requests: write; contents: write only if your repo requires it).
WORKFLOW_PAT:
required: true

jobs:

codegen:
name: Run codegen and pull request job
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:

- name: Setup .NET SDK step
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x

- name: Checkout code step
uses: actions/checkout@v6
with:
ref: main

- name: Run codegen step
run: |
dotnet run --project ./CreateMatrix/CreateMatrix.csproj -- \
matrix --versionpath=./Make/Version.json --matrixpath=./Make/Matrix.json --updateversion

- name: Format code step
run: |
dotnet tool restore
dotnet husky install
dotnet csharpier format --log-level=debug .
git status

- name: Create pull request step
uses: peter-evans/create-pull-request@v8
id: cpr
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: main
branch: codegen
title: 'Update codegen files'
body: 'This PR updates the codegen files.'
commit-message: 'Update codegen files'
delete-branch: true
sign-commits: true

- name: Trigger PR workflows step
if: steps.cpr.outputs.pull-request-number != ''
run: |
PR="${{ steps.cpr.outputs.pull-request-number }}"
gh pr close "$PR"
gh pr reopen "$PR"
env:
GH_TOKEN: ${{ secrets.WORKFLOW_PAT }}
Comment thread
ptr727 marked this conversation as resolved.
Resolved
Loading