File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4444 github_token : ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
4545
4646 - name : Create pull request
47+ id : create-pull
4748 uses : repo-sync/pull-request@33777245b1aace1a58c87a29c90321aa7a74bd7d
4849 env :
4950 GITHUB_TOKEN : ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
7273
7374 # There are cases where the branch becomes out-of-date in between the time this workflow began and when the pull request is created/updated
7475 - name : Update branch
76+ if : ${{ steps.find-pull-request.outputs.number }}
7577 uses : actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
7678 with :
77- github-token : ${{secrets.GITHUB_TOKEN}}
79+ github-token : ${{ secrets.GITHUB_TOKEN }}
7880 script : |
7981 const mainHeadSha = await github.git.getRef({
8082 ...context.repo,
@@ -84,13 +86,14 @@ jobs:
8486
8587 const pull = await github.pulls.get({
8688 ...context.repo,
87- pull_number: ${{ steps.find-pull-request.outputs.number }}
89+ pull_number: parseInt( ${{ steps.find-pull-request.outputs.number }})
8890 })
91+ console.log(`Pull request base sha: ${pull.data.base.sha}`)
8992
90- if (mainHeadSha.data.object.sha !== pull.data.base.sha) {
93+ if (mainHeadSha.data.object.sha !== pull.data.base.sha || pull.data.mergeable_state === 'behind' ) {
9194 const updateBranch = await github.pulls.updateBranch({
9295 ...context.repo,
93- pull_number: ${{ steps.find-pull-request.outputs.number }}
96+ pull_number: parseInt( ${{ steps.find-pull-request.outputs.number }})
9497 })
9598 console.log(updateBranch.data.message)
9699 } else {
You can’t perform that action at this time.
0 commit comments