-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6e902c1
Showing
4 changed files
with
158 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Test Action | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test-action: | ||
name: Test create PR on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/[email protected] | ||
|
||
- name: Create Pull Request | ||
id: create_pr | ||
uses: ./ | ||
with: | ||
title: 'Automated Pull Request' | ||
sourceBranch: ${{ github.ref_name }} | ||
targetBranch: 'main' | ||
body: 'This is an automated pull request.' | ||
labels: 'automated,pr' | ||
assignees: 'octocat' | ||
|
||
- name: Output PR URL | ||
run: echo "The PR URL is ${{ steps.create_pr.outputs.PRURL }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Remote Branch Action | ||
|
||
[![Test Action](https://github.com/JosiahSiegel/reliable-pull-request-action/actions/workflows/test-action.yml/badge.svg)](https://github.com/JosiahSiegel/reliable-pull-request-action/actions/workflows/test-action.yml) | ||
|
||
## Synopsis | ||
|
||
1. Create a pull request on a GitHub repository using existing branches. | ||
2. [actions/checkout](https://github.com/actions/checkout) determins the active repo. | ||
|
||
## Usage | ||
|
||
```yml | ||
jobs: | ||
create-pr: | ||
name: Test create PR on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/[email protected] | ||
|
||
- name: Create Pull Request | ||
id: create_pr | ||
uses: josiahsiegel/[email protected] | ||
with: | ||
title: 'Automated Pull Request' | ||
sourceBranch: ${{ github.ref_name }} | ||
targetBranch: 'main' | ||
body: 'This is an automated pull request.' | ||
labels: 'automated,pr' | ||
assignees: 'octocat' | ||
|
||
- name: Output PR URL | ||
run: echo "The PR URL is ${{ steps.create_pr.outputs.PRURL }}" | ||
``` | ||
## Inputs | ||
```yml | ||
inputs: | ||
title: | ||
description: 'Pull Request Title' | ||
required: true | ||
sourceBranch: | ||
description: 'Source Branch Name' | ||
required: true | ||
targetBranch: | ||
description: 'Target Branch Name' | ||
required: true | ||
body: | ||
description: 'Pull Request Body' | ||
required: false | ||
labels: | ||
description: 'Labels (comma-separated)' | ||
required: false | ||
assignees: | ||
description: 'Assignees (comma-separated)' | ||
required: false | ||
``` | ||
## Outputs | ||
```yml | ||
outputs: | ||
PRURL: | ||
description: 'The URL of the created pull request' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Reliable Pull Request Action | ||
description: Creates a pull request on a GitHub repository using existing branches | ||
branding: | ||
icon: 'git-pull-request' | ||
color: 'blue' | ||
inputs: | ||
title: | ||
description: 'Pull Request Title' | ||
required: true | ||
sourceBranch: | ||
description: 'Source Branch Name' | ||
required: true | ||
targetBranch: | ||
description: 'Target Branch Name' | ||
required: true | ||
body: | ||
description: 'Pull Request Body' | ||
required: false | ||
labels: | ||
description: 'Labels (comma-separated)' | ||
required: false | ||
assignees: | ||
description: 'Assignees (comma-separated)' | ||
required: false | ||
outputs: | ||
PRURL: | ||
description: 'The URL of the created pull request' | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Create Pull Request | ||
shell: bash | ||
run: bash create-pr.sh | ||
env: | ||
INPUT_TITLE: ${{ inputs.title }} | ||
INPUT_SOURCEBRANCH: ${{ inputs.sourceBranch }} | ||
INPUT_TARGETBRANCH: ${{ inputs.targetBranch }} | ||
INPUT_BODY: ${{ inputs.body }} | ||
INPUT_LABELS: ${{ inputs.labels }} | ||
INPUT_ASSIGNEES: ${{ inputs.assignees }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
# Create Pull Request and capture the output | ||
PR_OUTPUT=$(gh pr create \ | ||
--title "$INPUT_TITLE" \ | ||
--body "$INPUT_BODY" \ | ||
--base "$INPUT_TARGETBRANCH" \ | ||
--head "$INPUT_SOURCEBRANCH" \ | ||
--label "$INPUT_LABELS" \ | ||
--assignee "$INPUT_ASSIGNEES") | ||
|
||
# Extract PR URL from the output | ||
PR_URL=$(echo "$PR_OUTPUT" | grep -o 'https://github.com/[^ ]*') | ||
|
||
# Set the PR URL as the output | ||
echo "::set-output name=PRURL::$PR_URL" |