Skip to content

Commit

Permalink
Haggai/mobb 2136 propagate correct branch hash to bugsy through GitHu…
Browse files Browse the repository at this point in the history
…b fix (#20)

* Update action.yml

* Fix MOBB-2136 - Propagate correct branch hash to Bugsy through GitHub

* Add checkout support

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml
  • Loading branch information
yhaggai authored Jul 24, 2024
1 parent b5dfbbe commit 0ddacde
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on: [pull_request]
jobs:
test_job:
runs-on: ubuntu-latest
permissions:
statuses: write
name: A test job to test the action
steps:
# To use this repository's private action,
Expand Down
30 changes: 27 additions & 3 deletions review/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,30 @@ outputs:
runs:
using: "composite"
steps:
- uses: actions/upload-artifact@v4
id: vul-report-upload
with:
name: vul-report
path: ${{ inputs.report-file }}
run: echo "Artifact ID is ${{ steps.vul-report-upload.outputs.artifact-id }}"
shell: bash -l {0}

- uses: actions/checkout@v3
name: checkout-to-branch
with:
ref: ${{ github.head_ref }}

- id: download-vul-report
run: |
echo "url is: https://api.github.com/repos/$GITHUB_REPOSITORY/actions/artifacts/${{ steps.vul-report-upload.outputs.artifact-id }}/zip"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ inputs.github-token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-o vul_report.zip \
https://api.github.com/repos/$GITHUB_REPOSITORY/actions/artifacts/${{ steps.vul-report-upload.outputs.artifact-id }}/zip
unzip -d results vul_report.zip
shell: bash -l {0}
- uses: actions/[email protected]
with:
node-version: 18
Expand All @@ -32,15 +56,15 @@ runs:
REPO=${REPO%".git"}
GITHUB_TOKEN=${{ inputs.github-token }}
SCANNER=${{ inputs.scanner }}
COMMIT_HASH=$(git rev-parse $GITHUB_HEAD_REF)
PR_NUMBER=${{ github.event.pull_request.number }}
OUT=$(npx --yes mobbdev@latest review -r $REPO --ref $GITHUB_HEAD_REF --ch $GITHUB_SHA --api-key ${{ inputs.api-key }} -f ${{ inputs.report-file }} --pr $PR_NUMBER --github-token ${{ inputs.github-token }} --scanner $SCANNER)
OUT=$(npx --yes mobbdev@latest review -r $REPO --ref $GITHUB_HEAD_REF --ch $COMMIT_HASH --api-key ${{ inputs.api-key }} -f ${{ inputs.report-file }} --pr $PR_NUMBER --github-token ${{ inputs.github-token }} --scanner $SCANNER -p .)
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
exit $RETVAL
fi
OUT=$(echo $OUT | tr '\n' ' ')
echo "fix-report-url=$OUT" >> $GITHUB_OUTPUT
shell: bash -l {0}
- uses: Sibz/github-status-action@v1
Expand Down

0 comments on commit 0ddacde

Please sign in to comment.