test #62
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: Diff Compile | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
upload-diff: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Save PR number | |
run: echo "${{ github.event.pull_request.number }}" > pr_number.txt | |
- name: Generate Diff | |
run: git diff ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} --name-only > pr_diff.txt | |
- name: Print out diff | |
shell: bash | |
run: | | |
value=`cat pr_diff.txt` | |
echo $value | |
- name: Get PR comments | |
id: get-comments | |
run: | | |
pr_number=${{ github.event.pull_request.number }} | |
comments=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
"https://api.github.com/repos/${{ github.repository }}/issues/$pr_number/comments") | |
echo "$comments" | jq '[.[] | {user: .user.login, body: .body}]' > pr_comments.json | |
- name: Print out comments | |
shell: bash | |
run: | | |
value=`cat pr_comments.json` | |
echo $value | |
- name: Create artifact folder | |
run: mkdir -p auto_review_artifacts && mv pr_number.txt pr_comments.json pr_diff.txt auto_review_artifacts/ | |
- name: Upload PR details as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: auto-review-artifacts | |
path: auto_review_artifacts/ |