Automatically add the comment about executions when a new PR triggers (#1270)

Co-authored-by: toseven <Byone.heng@gmail.com>
This commit is contained in:
ToSeven 2023-05-17 06:30:15 +08:00 committed by GitHub
parent 6d2284d8b9
commit d2e4b9f206
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 6 deletions

View File

@ -230,6 +230,8 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, macos-latest] os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
outputs:
output_new_executions: ${steps.}
steps: steps:
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
@ -247,9 +249,28 @@ jobs:
- name: Build and run libfuzzer_libpng (Linux) - name: Build and run libfuzzer_libpng (Linux)
if: runner.os == 'Linux' if: runner.os == 'Linux'
run: ./scripts/executions-check.sh run: ./scripts/executions-check.sh
- name: Build and run libfuzzer_libpng (macOS) - name: Build and run libfuzzer_libpng (macOS)
if: runner.os == 'macOS' if: runner.os == 'macOS'
run: /usr/local/bin/bash -c './scripts/executions-check.sh' run: /usr/local/bin/bash -c './scripts/executions-check.sh'
- name: Post the execution count in a new PR (linux)
if: runner.os == 'Linux'
uses: wow-actions/auto-comment@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pullRequestOpened: |
On the Linux platform:
the execution count of the new fuzzer is ${{env.linux_new_executions}}
the execution count of the last fuzzer is ${{env.linux_last_executions}}
- name: Post the execution count in a new PR (macOS)
if: runner.os == 'macOS'
uses: wow-actions/auto-comment@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pullRequestOpened: |
On the MacOS platform:
the execution count of the new fuzzer is ${{env.macos_new_executions}}
the execution count of the last fuzzer is ${{env.macos_last_executions}}
nostd-build: nostd-build:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -40,17 +40,24 @@ main(){
install_libpng install_libpng
build_libpng build_libpng
echo "start to run the new fuzzer" #start to run the new fuzzer
new_executions=$(build_run_fuzzer) new_executions=$(build_run_fuzzer)
git_checkout git_checkout
build_libpng build_libpng
echo "start to run the last fuzzer" #start to run the last fuzzer
last_executions=$(build_run_fuzzer) last_executions=$(build_run_fuzzer)
echo "the execution count of the new fuzzer is $new_executions" prefix=""
echo "the execution count of the last fuzzer is $last_executions" if [ "$(uname)" == "Darwin" ]; then
prefix="macos"
else
prefix="linux"
fi
echo "${prefix}_new_executions=$new_executions" >> "$GITHUB_ENV"
echo "${prefix}_last_executions=$last_executions" >> "$GITHUB_ENV"
} }
main main