Skip to content

Commit

Permalink
Merge pull request #75 from communitiesuk/FS-2374
Browse files Browse the repository at this point in the history
Update to combine prs workflow
  • Loading branch information
aaronwilliamsv1 authored Nov 3, 2023
2 parents d9635f4 + 88fb078 commit bfb5db2
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/combine-prs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: 'Combine dependabot PRs'

permissions:
contents: write
pull-requests: write

# Controls when the action will run - in this case triggered manually
on:
workflow_dispatch:
Expand Down Expand Up @@ -46,6 +42,9 @@ on:
jobs:
# This workflow contains a single job called "combine-prs"
combine-prs:
permissions:
contents: write
pull-requests: write
# The type of runner that the job will run on
runs-on: ubuntu-latest

Expand All @@ -55,11 +54,11 @@ jobs:
id: create-combined-pr
name: Create Combined PR
with:
github-token: ${{secrets.GITHUB_TOKEN}}
github-token: ${{secrets.PAT_DEPENDABOT}}
script: |
const pulls = await github.paginate('GET /repos/:owner/:repo/pulls', {
owner: context.repo.owner,
repo: ${{ github.event.inputs.repository }}
repo: '${{ github.event.inputs.repository }}'
});
let branchesAndPRStrings = [];
let baseBranch = null;
Expand Down Expand Up @@ -89,7 +88,7 @@ jobs:
}`
const vars = {
owner: context.repo.owner,
repo: ${{ github.event.inputs.repository }},
repo: '${{ github.event.inputs.repository }}',
pull_number: pull['number']
};
const result = await github.graphql(stateQuery, vars);
Expand Down Expand Up @@ -127,7 +126,7 @@ jobs:
try {
await github.rest.git.createRef({
owner: context.repo.owner,
repo: ${{ github.event.inputs.repository }},
repo: '${{ github.event.inputs.repository }}',
ref: 'refs/heads/' + '${{ github.event.inputs.combineBranchName }}',
sha: baseBranchSHA
});
Expand All @@ -143,7 +142,7 @@ jobs:
try {
await github.rest.repos.merge({
owner: context.repo.owner,
repo: ${{ github.event.inputs.repository }},
repo: '${{ github.event.inputs.repository }}',
base: '${{ github.event.inputs.combineBranchName }}',
head: branch,
});
Expand All @@ -164,7 +163,7 @@ jobs:
}
await github.rest.pulls.create({
owner: context.repo.owner,
repo: ${{ github.event.inputs.repository }},
repo: '${{ github.event.inputs.repository }}',
title: 'Combined PR',
head: '${{ github.event.inputs.combineBranchName }}',
base: baseBranch,
Expand Down

0 comments on commit bfb5db2

Please sign in to comment.