Repository navigation
ref: bump sentry-protos to 0.112.0 #254025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: pre-commit | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| # Cancel in progress workflows on pull_requests. | |
| # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| # the default default is: | |
| # bash --noprofile --norc -eo pipefail {0} | |
| shell: bash --noprofile --norc -eo pipefail -ux {0} | |
| # hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359 | |
| env: | |
| SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3 | |
| # workaround: secrets cannot be directly referenced in `if` | |
| # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-secrets | |
| SECRET_ACCESS: ${{toJSON(secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY != null)}} | |
| jobs: | |
| lint: | |
| name: pre-commit lint | |
| runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-26.04-arm' || 'ubuntu-24.04' }} | |
| # Large PRs fall back to linting every file, which takes a few minutes. | |
| timeout-minutes: 15 | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| steps: | |
| - # get a non-default github token so that any changes are verified by CI | |
| if: env.SECRET_ACCESS == 'true' | |
| uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 | |
| id: token | |
| with: | |
| client-id: ${{ vars.SENTRY_INTERNAL_APP_ID }} | |
| private-key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }} | |
| - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| - name: Get changed files | |
| id: changes | |
| uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2 | |
| with: | |
| token: ${{ github.token }} | |
| # Enable listing of files matching each filter. | |
| # Paths to files will be available in `${FILTER_NAME}_files` output variable. | |
| list-files: json | |
| # It doesn't make sense to lint deleted files. | |
| # Therefore we specify we are only interested in added or modified files. | |
| filters: | | |
| all: | |
| - added|modified: '**/*' | |
| frontend: | |
| - 'static/**' | |
| - 'tests/js/**' | |
| - 'scripts/**' | |
| - '**/oxlint-suppressions.json' | |
| - '**/oxlint.config.ts' | |
| - 'oxlint.base.ts' | |
| - 'package.json' | |
| - 'pnpm-lock.yaml' | |
| - 'scripts/oxlint-suppressions.ts' | |
| - 'stylelint.config.js' | |
| - uses: ./.github/actions/setup-node-pnpm | |
| - uses: astral-sh/setup-uv@884ad927a57e558e7a70b92f2bccf9198a4be546 # v6 | |
| with: | |
| version: '0.13.7' | |
| # we just cache the venv-dir directly in action-setup-venv | |
| enable-cache: false | |
| - uses: getsentry/action-setup-venv@5a80476d175edf56cb205b08bc58986fa99d1725 # v3.2.0 | |
| with: | |
| cache-dependency-path: uv.lock | |
| install-cmd: uv sync --only-dev --frozen --active | |
| - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
| with: | |
| path: ~/.cache/prek | |
| key: cache-epoch-2|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
| - name: Setup prek | |
| run: | | |
| .venv/bin/prek prepare-hooks | |
| - name: Run prek on PR commits | |
| id: prek | |
| env: | |
| # Linux caps a single environment variable at 128 KiB, so a huge file list | |
| # stops bash from starting. Leave it empty and lint every file instead. | |
| ALL_FILES: ${{ fromJSON(steps.changes.outputs.all_count) <= 1000 && steps.changes.outputs.all_files || '' }} | |
| run: | | |
| if [ -z "$ALL_FILES" ]; then | |
| .venv/bin/prek run -q --all-files | |
| else | |
| jq '.[]' --raw-output <<< "$ALL_FILES" | | |
| xargs .venv/bin/prek run -q --files | |
| fi | |
| - name: Prune suppression budgets | |
| if: github.event_name == 'pull_request' && !cancelled() && (steps.prek.outcome == 'success' || steps.prek.outcome == 'failure') && steps.changes.outputs.frontend == 'true' | |
| run: pnpm run lint:suppressions --prune | |
| - name: Apply any pre-commit fixed files | |
| # Run after prek failures, but skip canceled runs that may have incomplete fixes. | |
| if: env.SECRET_ACCESS == 'true' && startsWith(github.ref, 'refs/pull') && !github.event.pull_request.draft && !cancelled() | |
| uses: getsentry/action-github-commit@31f6706ca1a7b9ad6d22c1b07bf3a92eabb05632 # v2.0.0 | |
| with: | |
| github-token: ${{ steps.token.outputs.token }} | |
| message: ':hammer_and_wrench: apply pre-commit fixes' |