From 28e3ea9ed795ede8ebded252669b519eb2eb006b Mon Sep 17 00:00:00 2001 From: Rodrigo Motta <55290205+rmottainfo@users.noreply.github.com> Date: Wed, 13 Aug 2025 22:10:04 -0300 Subject: [PATCH 1/2] Github Actions to create a pull request --- .github/workflows/gh-pr-create.yml | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/gh-pr-create.yml diff --git a/.github/workflows/gh-pr-create.yml b/.github/workflows/gh-pr-create.yml new file mode 100644 index 0000000..508277b --- /dev/null +++ b/.github/workflows/gh-pr-create.yml @@ -0,0 +1,41 @@ +name: Create a Pull Request + +on: + workflow_dispatch: + inputs: + repo: + description: 'Repositório de destino (ex: owner/repo-name)' + required: true + source_branch: + description: 'Branch de origem (head)' + required: true + target_branch: + description: 'Branch de destino (base)' + required: true + title: + description: 'Título do Pull Request' + required: true + body: + description: 'Corpo do Pull Request' + required: false + +permissions: + contents: write + pull-requests: write + +jobs: + create_pr: + runs-on: ubuntu-latest + steps: + - name: Create Pull Request + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + gh pr create \ + --repo ${{ github.event.inputs.repo }} \ + --title "${{ github.event.inputs.title }}" \ + --body "${{ github.event.inputs.body }}" \ + --head ${{ github.event.inputs.source_branch }} \ + --base ${{ github.event.inputs.target_branch }} + + echo "::notice title=Criação de PR Concluída::O Pull Request foi criado com sucesso." From d7d40f5b14ec2277e992238a94e28d560b8c4c4d Mon Sep 17 00:00:00 2001 From: Rodrigo Motta <55290205+rmottainfo@users.noreply.github.com> Date: Wed, 13 Aug 2025 22:10:47 -0300 Subject: [PATCH 2/2] Github Actions to merge a pull request --- .github/workflows/gh-pr-merge.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/gh-pr-merge.yml diff --git a/.github/workflows/gh-pr-merge.yml b/.github/workflows/gh-pr-merge.yml new file mode 100644 index 0000000..a21a97e --- /dev/null +++ b/.github/workflows/gh-pr-merge.yml @@ -0,0 +1,25 @@ +name: Merge Squesh a Pull Request + +on: + workflow_dispatch: + inputs: + pr_url: + description: 'Pull Request link.' + required: true + default: 'https://github.com/owner/repo-name/pull/1' + +permissions: + contents: write + pull-requests: write + +jobs: + merge_pr: + runs-on: ubuntu-latest + steps: + - name: Merge Squash a Pull Request + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + gh pr merge ${{ github.event.inputs.pr_url }} --squash + + echo "::notice title=Merge Concluído::O Pull Request foi mesclado com sucesso."