test #56
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 > my_diff.txt | |
- name: Print out diff | |
shell: bash | |
run: | | |
value=`cat my_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: Upload Diff as Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: my-diff | |
path: my_diff.txt | |
- name: Upload PR Comments as Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pr-comments | |
path: pr_comments.json | |
- name: Upload PR Number as Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pr-number | |
path: pr_number.txt |