diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml index f5bbe92..9eef49b 100644 --- a/.github/workflows/test-action.yml +++ b/.github/workflows/test-action.yml @@ -2,11 +2,8 @@ name: Test Action on: push: - branches: - - main - pull_request: - branches: - - main + branches-ignore: + - 'main' jobs: test-action: @@ -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 }}" diff --git a/README.md b/README.md index 0ce5d54..b48ffd4 100644 --- a/README.md +++ b/README.md @@ -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) @@ -67,4 +69,11 @@ inputs: outputs: PRURL: description: 'The URL of the created pull request' -``` \ No newline at end of file +``` + +## Requirements + +The following permissions must be set for the repository: + * `Settings > Actions > General` + * ![](gh_workflow_permissions.png) +*Alternative is to set [jobs..permissions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idpermissions)* \ No newline at end of file diff --git a/action.yml b/action.yml index 573a91a..63a2322 100644 --- a/action.yml +++ b/action.yml @@ -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: diff --git a/create-pr.sh b/create-pr.sh index 2a5ff2a..c6046c0 100644 --- a/create-pr.sh +++ b/create-pr.sh @@ -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 diff --git a/gh_workflow_permissions.png b/gh_workflow_permissions.png new file mode 100644 index 0000000..5cea0a8 Binary files /dev/null and b/gh_workflow_permissions.png differ