Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverted pull-requests to issues write permissions #664

Merged
merged 2 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/pr-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Pull Request Comment

on:
workflow_run:
workflows: ["Benchmark Suite"]
types:
- completed

jobs:
upload:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- uses: actions/download-artifact@v3
with:
name: pr
path: ./var/phpbench/pr-id.txt

- name: save PR id
id: pr
run: |
echo "id=$(<pr-id.txt)" >> $GITHUB_OUTPUT

- uses: actions/download-artifact@v3
with:
name: phpbench
path: ./var/phpbench/summary.txt

- name: Get Benchmarks Output
id: get-benchmarks
run: |
echo "content<<EOF" >> $GITHUB_OUTPUT
echo "$(cat ./var/phpbench/summary.txt)" >> $GITHUB_OUTPUT
echo EOF >> $GITHUB_OUTPUT

- name: "Find Comment"
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ steps.pr.outputs.id }}
comment-author: 'github-actions[bot]'
body-includes: '# Flow PHP - Benchmarks'

- name: "Create or update comment"
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ steps.pr.outputs.id }}
body: ${{ steps.get-benchmarks.outputs.content }}
edit-mode: replace
29 changes: 11 additions & 18 deletions .github/workflows/test-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ on:
- 'composer.json'
- 'composer.lock'

permissions:
pull-requests: write

# See https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -75,7 +72,6 @@ jobs:
id: init_comment
run: |
{
echo 'COMMENT_CONTENT<<EOF'
echo '# Flow PHP - Benchmarks'
echo '<sup><sub>Results of the benchmarks from this PR are compared with the results from 1.x branch.</sub></sup>'
echo ' '
Expand Down Expand Up @@ -111,24 +107,21 @@ jobs:
echo ' '
echo '</details>'
echo ' '
echo EOF
} >> "$GITHUB_ENV"
} >> "./var/phpbench/summary.txt"

- name: "Find Comment"
uses: peter-evans/find-comment@v2
id: fc
- uses: actions/upload-artifact@v3
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '# Flow PHP - Benchmarks'
name: phpbench
path: ./var/phpbench/summary.txt

- name: Save PR number
run: echo ${{ github.event.pull_request.number }} > ./pr-id.txt

- name: "Create or update comment"
uses: peter-evans/create-or-update-comment@v3
- name: Upload PR number
uses: actions/upload-artifact@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: ${{ env.COMMENT_CONTENT }}
edit-mode: replace
name: pr
path: ./pr-id.txt

- name: "Set job summary"
run: |
Expand Down