Add commit check for PRs #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check pull requests for chains | |
on: | |
pull_request: | |
paths: | |
- 'chains/**' | |
env: | |
BODY_FILE: body_file.txt | |
jobs: | |
create-comment-with-changes: | |
runs-on: ubuntu-latest | |
name: Create a comment with chains changed data | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: make init | |
- name: Build body text | |
run: echo This comment was written by a bot! >> ${{ env.BODY_FILE }} | |
- name: Run check_json.py | |
run: make check-chains-file | |
- name: Find Comment | |
if: always() | |
uses: peter-evans/find-comment@v2 | |
id: fc | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: This comment was written by a bot! | |
- name: Create comment | |
if: always() && steps.fc.outputs.comment-id == '' | |
uses: peter-evans/create-or-update-comment@v2 | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
body-file: ${{ env.BODY_FILE }} | |
- name: Update comment | |
if: always() && steps.fc.outputs.comment-id != '' | |
uses: peter-evans/create-or-update-comment@v2 | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
body-file: ${{ env.BODY_FILE }} | |
edit-mode: replace |