Skip to content

Commit

Permalink
action: fix checkout on pull_request_target
Browse files Browse the repository at this point in the history
The `pull_request_target` trigger will checkout the master branch
codes by default, but we need to use the new PR codes on smoke test.

See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target

Signed-off-by: Yan Song <imeoer@linux.alibaba.com>
  • Loading branch information
imeoer authored and Desiki-high committed Apr 21, 2023
1 parent ca9f7a8 commit b937989
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: ["**", "stable/**"]
paths-ignore: [ '**.md', '**.png', '**.jpg', '**.svg', '**/docs/**' ]
pull_request_target:
pull_request:
branches: ["**", "stable/**"]
paths-ignore: [ '**.md', '**.png', '**.jpg', '**.svg', '**/docs/**' ]
schedule:
Expand Down Expand Up @@ -396,7 +396,7 @@ jobs:

benchmark-result:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request_target'
if: github.event_name == 'pull_request'
needs: [benchmark-oci, benchmark-zran-all-prefetch, benchmark-nydus-no-prefetch, benchmark-nydus-all-prefetch, benchmark-nydus-filelist-prefetch]
steps:
- name: Download benchmark-oci
Expand Down Expand Up @@ -432,8 +432,8 @@ jobs:
sudo install -m 755 benchmark-nydus-all-prefetch/wordpress.csv nydus-all-prefetch.csv
sudo install -m 755 benchmark-nydus-filelist-prefetch/wordpress.csv nydus-filelist-prefetch.csv
echo "| benchmark-result | pull-elapsed(s) | create-elapsed(s) | run-elapsed(s) | total-elapsed(s) |" > result.md
echo "|:-------|:-----------------:|:-------------------:|:----------------:|:------------------:|" >> result.md
echo "| benchmark-result | pull-elapsed(s) | create-elapsed(s) | run-elapsed(s) | total-elapsed(s) |" > $GITHUB_STEP_SUMMARY
echo "|:-------|:-----------------:|:-------------------:|:----------------:|:------------------:|" >> $GITHUB_STEP_SUMMARY
for file in *.csv; do
if ! [ -f "$file" ]; then
Expand All @@ -446,23 +446,8 @@ jobs:
run=$(echo "$line" | cut -d ',' -f 4)
total=$(echo "$line" | cut -d ',' -f 5)
printf "| %s | %s | %s | %s | %s |\n" "$filename" "$pull" "$create" "$run" "$total"
done >> result.md
done >> $GITHUB_STEP_SUMMARY
done
- name: Comment
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const markdownFilePath = './result.md';
const markdownContent = fs.readFileSync(markdownFilePath, 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: markdownContent
})
nydus-unit-test:
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit b937989

Please sign in to comment.