From 08ab0458fdbe7a2c0fc7267650d3e53a8d0203fd Mon Sep 17 00:00:00 2001 From: Robert Duncan Date: Sat, 21 Oct 2023 21:15:08 -0700 Subject: [PATCH] feat: post github comment on pr --- .github/workflows/main.yaml | 24 +++++++++++++++++++++++- test_files/new_doctype_renamed_old.json | 3 +-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 2ee7778..a36f63e 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -25,7 +25,29 @@ jobs: - name: Diff run: | - git --no-pager diff HEAD~1 HEAD + git --no-pager diff HEAD~1 HEAD > diff_output.txt + + - name: Convert ansi to html + if: github.event_name == 'pull_request' + run: | + pip install ansi2html + cat diff_output | ansi2html > diff_output.html + + - name: Post comment + if: github.event_name == 'pull_request' + uses: actions/github-script@v6 + with: + script: | + const fs = require('fs'); + const output = fs.readFileSync('output.html', 'utf8'); + const issue_number = context.issue.number; + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue_number, + body: output, + }); + diff --git a/test_files/new_doctype_renamed_old.json b/test_files/new_doctype_renamed_old.json index 73fde0c..ee4f23d 100644 --- a/test_files/new_doctype_renamed_old.json +++ b/test_files/new_doctype_renamed_old.json @@ -22,8 +22,7 @@ }, { "fieldname": "new_docfield_2", - "fieldtype": "Int", - "label": "New Docfield 2" + "fieldtype": "Int" }, { "fieldname": "new_docfield_3",