Skip to content

Olive Recipe for Facebook Segment Anything Models (#159) #5

Olive Recipe for Facebook Segment Anything Models (#159)

Olive Recipe for Facebook Segment Anything Models (#159) #5

Workflow file for this run

name: scanner
description: "CI workflow to scan and populate model directory tables in README.md"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches:
- main
env:
PYTHON_VERSION: "3.10"
GHA_PR_BRANCH: "gha/update-$${{ github.run_id }}"
jobs:
scan:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }} # ref is required as GitHub Actions checks out in detached HEAD mode
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies and run scanner
run: |
python -m pip install pyyaml
python .github/scripts/scanner.py --dirpath . --verbose
- name: Check for Changes
id: check_changes
run: |
if [[ -n "$(git diff --exit-code)" ]]; then
echo "Changes detected."
echo "::set-output name=has_changes::true"
else
echo "No changes detected."
echo "::set-output name=has_changes::false"
fi
- name: Create a new branch for the PR
if: steps.check_changes.outputs.has_changes == 'true'
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git checkout -b "${{ env.GHA_PR_BRANCH }}"
git add README.md
git commit -m "[Scanner]: Ran scanner and update README.md"
git push origin "${{ env.GHA_PR_BRANCH }}"