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

Update to combine prs workflow #75

Merged
merged 1 commit into from
Nov 3, 2023
Merged
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
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
Loading