diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a96aab20..deb0667d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ jobs: node-version: 12 - name: Opening pull request id: pull - uses: tretuna/sync-branches@v1 + uses: ./ with: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} ACTIONS_RUNNER_DEBUG: true diff --git a/README.md b/README.md index 18eeed50..7c6516e7 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,12 @@ What you would like in the body of the pull request. Default: `sync-branches: New code has just landed in {FROM_BRANCH} so let's bring {TO_BRANCH} up to speed!` +## Outputs + +### `PULL_REQUEST_URL` + +Set to the URL of either the pull request that was opened by this action or the one that was found to already be open between the two branches. + ## Example usage ```YML diff --git a/action.yml b/action.yml index 214b993d..a88d181f 100644 --- a/action.yml +++ b/action.yml @@ -1,7 +1,8 @@ name: "Sync branches" description: "GitHub Action to, upon successful merge, open a pull request to sync the updated branch back to one or more other branches." -icon: git-pull-request -color: green +branding: + icon: git-pull-request + color: green inputs: GITHUB_TOKEN: description: "User token to be associated with this pull request." @@ -18,6 +19,9 @@ inputs: PULL_REQUEST_BODY: description: "What you would like in the body of the pull request. Default: 'New code has just landed in {fromBranch} so let's bring {toBranch} up to speed!'" required: false +outputs: + PULL_REQUEST_URL: + description: "URL for either the generated pull request or the currently open one" runs: using: "node12" main: "dist/index.js" diff --git a/index.js b/index.js index 7f614667..e5c9562e 100644 --- a/index.js +++ b/index.js @@ -43,11 +43,15 @@ async function run() { console.log( `Pull request successful! You can view it here: ${pullRequest.url}.` ); + + core.setOutput("PULL_REQUEST_URL", pullRequest.url); } else { console.log( `There is already a pull request to ${toBranch} from ${fromBranch}.`, `You can view it here: ${currentPull.url}` ); + + core.setOutput("PULL_REQUEST_URL", currentPull.url); } } catch (error) { core.setFailed(error.message);