test semgrep 2 (#9509)

* test semgrep 2

* add changeset

* status

* add yml
:

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
Abubakar Abid 2024-10-02 16:11:50 -07:00 committed by GitHub
parent b25a64e98b
commit cc9674b101
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 54 additions and 27 deletions

View File

@ -0,0 +1,5 @@
---
"gradio": minor
---
feat:test semgrep 2

View File

@ -2,7 +2,7 @@ name: Semgrep
on:
workflow_run:
workflows: ["trigger-changeset"]
workflows: ["trigger-semgrep"]
types:
- completed
@ -17,39 +17,32 @@ concurrency:
permissions: {}
jobs:
changes:
permissions:
contents: read
pull-requests: read
name: "changes"
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.changes.outputs.should_run }}
sha: ${{ steps.changes.outputs.sha }}
source_branch: ${{ steps.changes.outputs.source_branch }}
source_repo: ${{ steps.changes.outputs.source_repo }}
pr_number: ${{ steps.changes.outputs.pr_number }}
steps:
- uses: actions/checkout@v4
- uses: "gradio-app/gradio/.github/actions/changes@main"
id: changes
with:
filter: "gradio"
token: ${{ secrets.GITHUB_TOKEN }}
semgrep:
permissions:
contents: read
name: semgrep/ci
runs-on: ubuntu-latest
needs: changes
container:
image: semgrep/semgrep
outputs:
pr_number: ${{ steps.json.outputs.pr_number }}
sha: ${{ steps.json.outputs.sha }}
if: (github.actor != 'dependabot[bot]')
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: changes
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- uses: gradio-app/github/actions/json-to-output@main
id: json
with:
path: output.json
- uses: actions/checkout@v4
with:
repository: ${{ needs.changes.outputs.source_repo }}
ref: ${{ needs.changes.outputs.sha }}
repository: ${{ steps.json.outputs.source_repo }}
ref: ${{ steps.json.outputs.sha }}
- run: semgrep ci
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN2 }}
@ -58,14 +51,14 @@ jobs:
actions: read
statuses: write
runs-on: ubuntu-latest
needs: [changes, semgrep]
needs: semgrep
steps:
- name: update status
uses: gradio-app/github/actions/commit-status@main
with:
sha: ${{ needs.changes.outputs.sha }}
sha: ${{ needs.semgrep.outputs.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
name: "Semgrep Results"
pr: ${{ needs.changes.outputs.pr_number }}
pr: ${{ needs.semgrep.outputs.pr_number }}
result: ${{ needs.semgrep.result == 'success' && 'success' || 'failure' }}
type: all

29
.github/workflows/trigger-semgrep.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: trigger-changeset
on:
pull_request:
branches:
- main
- 5.0-dev
permissions: {}
jobs:
changes:
permissions:
contents: read
pull-requests: read
name: "changes"
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.changes.outputs.should_run }}
sha: ${{ steps.changes.outputs.sha }}
pr_number: ${{ steps.changes.outputs.pr_number }}
source_branch: ${{ steps.changes.outputs.source_branch }}
source_repo: ${{ steps.changes.outputs.source_repo }}
steps:
- uses: actions/checkout@v4
- uses: "gradio-app/gradio/.github/actions/changes@main"
id: changes
with:
filter: "gradio"
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,5 +1,5 @@
"""
This file defines two useful high-level abstractions to build Gradio apps: Interface and TabbedInterface.
This file defines two useful high-level abstractions to build Gradio apps: Interface and TabbedInterface.
"""
from __future__ import annotations