Skip to content

Commit

Permalink
Merge pull request #9 from JosiahSiegel/test-action
Browse files Browse the repository at this point in the history
Automated Pull Request
  • Loading branch information
JosiahSiegel authored Feb 19, 2024
2 parents 61f5be0 + fdebc65 commit 30cf8d2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ name: Test Action

on:
push:
branches:
- main
pull_request:
branches:
- main
branches-ignore:
- 'main'

jobs:
test-action:
Expand All @@ -30,7 +27,7 @@ jobs:
targetBranch: 'main'
body: 'This is an automated pull request.'
labels: 'invalid,wontfix'
assignees: 'octocat'
assignees: ${{ github.actor }}

- name: Output PR URL
run: echo "The PR URL is ${{ steps.create_pr.outputs.PRURL }}"
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Remote Branch Action
# Reliable Pull Request Action

> *Reliable: Only uses built-in GitHub runner commands
[![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)

Expand Down Expand Up @@ -67,4 +69,11 @@ inputs:
outputs:
PRURL:
description: 'The URL of the created pull request'
```
```
## Requirements
The following permissions must be set for the repository:
* `Settings > Actions > General`
* ![](gh_workflow_permissions.png)
*Alternative is to set [jobs.<job_id>.permissions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idpermissions)*
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ inputs:
outputs:
PRURL:
description: 'The URL of the created pull request'
value: ${{ steps.create_pr.outputs.PR_URL }}
runs:
using: 'composite'
steps:
- name: Create Pull Request
id: create_pr
shell: bash
run: bash create-pr.sh
env:
Expand Down
4 changes: 2 additions & 2 deletions create-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ PR_OUTPUT=$(gh pr create \
--base "$INPUT_TARGETBRANCH" \
--head "$INPUT_SOURCEBRANCH" \
--label "$INPUT_LABELS" \
--assignee "$INPUT_ASSIGNEES")
--assignee "$INPUT_ASSIGNEES" 2>&1)

# Extract PR URL from the output
PR_URL=$(echo "$PR_OUTPUT" | grep -o 'https://github.com/[^ ]*')

# Set the PR URL as the output
echo "name=$PR_URL" >> $GITHUB_OUTPUT
echo "PR_URL=$PR_URL" >> $GITHUB_OUTPUT
Binary file added gh_workflow_permissions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 30cf8d2

Please sign in to comment.