Skip to content

Commit

Permalink
print changeset file content in GH comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofel committed Sep 16, 2024
1 parent dcb3aa9 commit 56a1058
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/solidity-tracability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,39 @@ jobs:
env:
GITHUB_TOKEN: ${{ steps.get-gh-token.outputs.access-token }}

- name: Read changeset file content
shell: bash
id: read-changeset-file
run: |
# we know there's only one file, because otherwise "Enforce Traceability" step would have failed
# Extract content after the last occurrence of '---' to avoid problems with GITHUB_OUTPUT
changesets_file_content=$(awk 'BEGIN {RS="---"; FS="\n";} {content=$0} END {print content}' "${{ needs.files-changed.outputs.changesets_files }}" | sed '/^$/d')
echo "changesets_file_content=$changesets_file_content" >> $GITHUB_OUTPUT
- name: Find traceability comment in the PR
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.0.0
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: 'Solidity Review Jira issue'

- name: Create or update traceability comment in the PR
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
## Solidity Review Jira issue
Hey @${{ github.event.push && github.event.push.pusher && github.event.push.pusher.username || github.actor }}, we have linked this PR to a Jira issue for Solidity Review.
Please make sure that the linkage is correct and in a contrary case, please update the linkage manually in JIRA and replace Solidity Review issue in the changeset file, with the correct one.
Below you can find current content of the (changeset)[${{ needs.files-changed.outputs.changesets_files }}] file:
```
${{ steps.read-changeset-file.outputs.changesets_file_content }}
```
edit-mode: replace

- name: Collect Metrics
id: collect-gha-metrics
if: always()
Expand Down

0 comments on commit 56a1058

Please sign in to comment.