Skip to content

Commit

Permalink
Workaround for fork PR permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
H-Plus-Time committed Dec 3, 2023
1 parent b7e0503 commit 08a8698
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 5 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/pr-manipulation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: PR Comment Generation

on:
workflow_run:
workflows: ["Build and Test"]
types:
- completed

jobs:
comment_on_pr:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: 'Download artifact'
uses: actions/[email protected]
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
- run: unzip pr.zip

- name: Comment PR with summary output
uses: thollander/actions-comment-pull-request@v2
with:
filePath: step_summary.md
comment_tag: execution
11 changes: 6 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,10 @@ jobs:
COMPRESSED_SIZE=$(cat "${asset}.br" | pv -f -b 2>&1 >/dev/null | tr -d '\n\r')
echo "| ${asset} | $SIZE | $COMPRESSED_SIZE |" >> $GITHUB_STEP_SUMMARY
done;
cp $GITHUB_STEP_SUMMARY fixed_output.md
- name: Comment PR with summary output
uses: thollander/actions-comment-pull-request@v2
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
cp $GITHUB_STEP_SUMMARY ./pr/step_summary.md
- uses: actions/upload-artifact@v2
with:
filePath: fixed_output.md
comment_tag: execution
name: pr
path: pr/

0 comments on commit 08a8698

Please sign in to comment.