Skip to content

Commit

Permalink
Add test command in PR comment (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelburnham authored Oct 26, 2023
1 parent 6026693 commit db71a45
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/pr-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: PR comment test

on:
issue_comment:
types: [created]

env:
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
run-test:
name: run test
runs-on: ubuntu-latest
if:
github.event.issue.pull_request
&& github.event.issue.state == 'open'
&& contains(github.event.comment.body, '!test')
&& (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER')
steps:
- uses: xt0rted/pull-request-comment-branch@v2
id: comment-branch
- uses: actions/checkout@v4
- name: Checkout PR branch
run: gh pr checkout ${{ github.event.issue.number }}
env:
# TODO: Remove if not needed
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check private key exists
# Potential alternative: https://github.com/myrotvorets/set-commit-status-action
uses: actions/github-script@v6
with:
script: |
if ("$PRIVATE_KEY" == "") {
core.setFailed('Failed to access PRIVATE_KEY secret')
}

0 comments on commit db71a45

Please sign in to comment.