Spaces:
Sleeping
Sleeping
Download .github/workflows/gate.yml from DecodeMarketing/video_frame: direct link, hf CLI and curl.
- Browser
- Download file 4.24 kB
-
https://huggingface.co/spaces/DecodeMarketing/video_frame/resolve/main/.github/workflows/gate.yml
- Command line
-
hf download hf://spaces/DecodeMarketing/video_frame/.github/workflows/gate.yml
-
curl -L -o gate.yml https://huggingface.co/spaces/DecodeMarketing/video_frame/resolve/main/.github/workflows/gate.yml
4.24 kB
| name: DECODE gate | |
| on: | |
| pull_request: | |
| branches: [main, master] | |
| push: | |
| branches: [main, master] | |
| jobs: | |
| language-gate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install language-gate dependencies | |
| run: | | |
| set -euo pipefail | |
| if [ -f "package.json" ]; then | |
| npm ci --no-audit --no-fund >/dev/null | |
| fi | |
| if grep -qE '\.py$' <(git ls-files) || [ -f "pyproject.toml" ] || [ -f "setup.py" ]; then | |
| python -m pip install --upgrade pip >/dev/null | |
| pip install ruff >/dev/null | |
| fi | |
| - name: Detect changes and run shared language gate | |
| run: | | |
| set -euo pipefail | |
| if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then | |
| git diff --name-only "origin/${GITHUB_BASE_REF}"...HEAD > /tmp/changed.txt | |
| else | |
| if git rev-parse HEAD~1 >/dev/null 2>&1; then | |
| git diff --name-only HEAD~1..HEAD > /tmp/changed.txt | |
| else | |
| git ls-files > /tmp/changed.txt | |
| fi | |
| fi | |
| echo "Changed files:" | |
| cat /tmp/changed.txt | |
| mapfile -t CHANGED < /tmp/changed.txt | |
| if [ "${#CHANGED[@]}" -eq 0 ]; then | |
| exit 0 | |
| fi | |
| bash scripts/language-gate.sh "${CHANGED[@]}" | |
| override-audit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Report override-reviewer usage | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| BASE_REF: ${{ github.base_ref }} | |
| BEFORE_SHA: ${{ github.event.before }} | |
| run: | | |
| set -euo pipefail | |
| if [ "$EVENT_NAME" = "pull_request" ]; then | |
| RANGE="origin/${BASE_REF}..HEAD" | |
| LABEL="PR" | |
| else | |
| if [ -n "${BEFORE_SHA:-}" ] && [ "$BEFORE_SHA" != "0000000000000000000000000000000000000000" ]; then | |
| RANGE="${BEFORE_SHA}..HEAD" | |
| elif git rev-parse HEAD~1 >/dev/null 2>&1; then | |
| RANGE="HEAD~1..HEAD" | |
| else | |
| # root commit with no parent | |
| RANGE="HEAD" | |
| fi | |
| LABEL="push" | |
| fi | |
| OVERRIDES=$(git log --format='%H %s' "$RANGE" 2>/dev/null | grep -E '\[override-reviewer:' || true) | |
| if [ -n "$OVERRIDES" ]; then | |
| echo "This $LABEL contains reviewer overrides:" | |
| echo "$OVERRIDES" | |
| fi | |
| ci-fail-incident: | |
| runs-on: ubuntu-latest | |
| needs: [language-gate] | |
| if: failure() && github.event_name == 'push' | |
| steps: | |
| - name: File incident in decode-claude-wiki | |
| env: | |
| INCIDENT_LOG_TOKEN: ${{ secrets.INCIDENT_LOG_TOKEN }} | |
| REPO_NAME: ${{ github.repository }} | |
| SHA: ${{ github.sha }} | |
| RUN_ID: ${{ github.run_id }} | |
| SERVER_URL: ${{ github.server_url }} | |
| REPO_FULL: ${{ github.repository }} | |
| WORKFLOW_NAME: ${{ github.workflow }} | |
| run: | | |
| set -euo pipefail | |
| if [ -z "${INCIDENT_LOG_TOKEN:-}" ]; then | |
| echo "INCIDENT_LOG_TOKEN secret not set — skipping incident filing" | |
| exit 0 | |
| fi | |
| SHORT_SHA="${SHA:0:7}" | |
| DATE=$(date -u +%Y-%m-%d) | |
| REPO_BASENAME="${REPO_NAME##*/}" | |
| RUN_URL="${SERVER_URL}/${REPO_FULL}/actions/runs/${RUN_ID}" | |
| TITLE="incident: ${DATE} ${REPO_BASENAME} ci-fail ${SHORT_SHA}" | |
| BODY=$(cat <<EOF | |
| Automated incident from ${REPO_BASENAME} CI gate failure. | |
| - Repo: \`${REPO_BASENAME}\` | |
| - Commit: \`${SHORT_SHA}\` | |
| - Workflow: ${WORKFLOW_NAME} | |
| - Run: ${RUN_URL} | |
| Triage: open the run above, determine whether this is a real incident (something broke) or noise (flaky test, env issue). If real, convert to docs/incidents/ and close this issue linking to the MD file. | |
| EOF | |
| ) | |
| echo "$INCIDENT_LOG_TOKEN" | gh auth login --with-token | |
| gh issue create \ | |
| -R implicitdiagnosticsandsolutions/decode-claude-wiki \ | |
| -t "$TITLE" \ | |
| -l "incident,ci-fail" \ | |
| -b "$BODY" | |