Skip to content

Commit

Permalink
fix(actions/create-and-merge-pull-request): approve PR before merging
Browse files Browse the repository at this point in the history
  • Loading branch information
neilime committed Mar 24, 2023
1 parent 0df68af commit a229912
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/release-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ jobs:
- uses: hoverkraft-tech/ci-github-common/actions/create-and-merge-pull-request@main
with:
github-token: ${{ secrets.github-token }}
branch: docs/actions-readme
title: "docs: update actions README"
body:
branch: docs/actions-workflows-documentation-update
title: "docs: update actions and workflows documentation"
body: Update actions and workflows documentation
commit-message: |
docs: update actions README
docs: update actions and workflows documentation
[skip ci]
10 changes: 10 additions & 0 deletions actions/checkout/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ Action to checkout the repository compatible for PRs, issues and push events. Wo
<!-- end description -->
<!-- start contents -->
<!-- end contents -->

Set permissions to read contents and pull-requests. This is required to get the PR branch.

```yaml
on: issue_comment
permissions:
contents: read
pull-requests: read
```
<!-- start usage -->
```yaml
Expand Down
12 changes: 10 additions & 2 deletions actions/create-and-merge-pull-request/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ branding:

inputs:
github-token:
description: 'Github token for creating and merging pull request (permissions contents: write and pull-requests: write). Can be passed in using "secrets.GITHUB_TOKEN". See https://github.com/peter-evans/create-pull-request#action-inputs'
description: 'GitHub token for creating and merging pull request (permissions contents: write and pull-requests: write). Can be passed in using "secrets.GITHUB_TOKEN". See https://github.com/peter-evans/create-pull-request#action-inputs'
required: true
branch:
description: "The pull request branch name"
Expand All @@ -29,10 +29,18 @@ runs:
id: create-pull-request
with:
token: ${{ inputs.github-token }}
commit-message: ${{ inputs.commit-message }}
signoff: true
base: ${{ github.event.repository.default_branch }}
delete-branch: true
branch: ${{ inputs.branch }}
title: ${{ inputs.title }}
body: ${{ inputs.body }}
commit-message: ${{ inputs.commit-message }}

- uses: juliangruber/approve-pull-request-action@v2.0.4
with:
github-token: ${{ inputs.github-token }}
number: ${{ steps.create-pull-request.outputs.pull-request-number }}

- uses: juliangruber/merge-pull-request-action@v1
if: steps.create-pull-request.outputs.pull-request-operation != 'closed'
Expand Down

0 comments on commit a229912

Please sign in to comment.