Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated Pull Request #9

Merged
merged 7 commits into from
Feb 19, 2024
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
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.