Skip to content

Commit

Permalink
Add composite github action
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 committed Sep 17, 2024
1 parent 1c86c01 commit fe15460
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,28 @@ Program to simplify PCI double approval process across repositories

0. Install nix
1. Run `nix-shell`
2. Run `cargo run`
2. Run `cargo build`
3. Run `cargo test`
4. Run `cargo deny check`

## GitHub Action usage

pear-reviewer can be used as a GitHub Actions workflow to comment the review template on PRs.

```yaml
name: pear-reviewer
on:
pull_request:
branches:
- '*'

permissions:
pull-requests: write

jobs:
review:
name: Review
runs-on: ubuntu-latest
steps:
- uses: sapcc/pear-reviewer@main
```
42 changes: 42 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'pear-reviewer'
description: 'Run pear-reviewer'
runs:
using: "composite"
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Run pear-reviewer
id: run-pear-reviewer
uses: docker://ghcr.io/sapcc/pear-reviewer:latest
run:
pear-reviewer > $GITHUB_OUTPUT

- name: Find Comment
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: <!-- written by pear-reviewer -->

- name: Create comment
if: steps.find-comment.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
<!-- written by pear-reviewer -->
${{ steps.run-pear-rewiwer.outputs.comment }}
- name: Update comment
if: steps.find-comment.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
body: |
<!-- written by pear-reviewer -->
${{ steps.run-pear-rewiwer.outputs.result }}
edit-mode: replace

0 comments on commit fe15460

Please sign in to comment.