ci: harden GitHub Actions against supply chain attacks #1952
Workflow file for this run
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: API Stability Check | |
| on: | |
| pull_request: | |
| paths: | |
| - 'ddtrace/tracer/**' | |
| - 'scripts/apiextractor/**' | |
| - '.github/workflows/api-check.yml' | |
| permissions: | |
| contents: read | |
| jobs: | |
| check-api-stability: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Go and development tools | |
| uses: ./.github/actions/setup-go | |
| with: | |
| go-version: stable | |
| tools-dir: ${{ github.workspace }}/_tools | |
| tools-bin: ${{ github.workspace }}/bin | |
| - name: Generate current API for ddtrace/tracer | |
| run: | | |
| go run ./scripts/apiextractor/api_extractor.go ./ddtrace/tracer > current_api.txt | |
| - name: Compare with committed API | |
| run: | | |
| if ! diff -u ./ddtrace/tracer/api.txt current_api.txt; then | |
| echo "❌ API changes detected but api.txt not updated!" | |
| echo "Please run 'go run ./scripts/apiextractor/api_extractor.go ./ddtrace/tracer > ./ddtrace/tracer/api.txt'" | |
| echo "and commit the changes." | |
| exit 1 | |
| fi | |
| echo "✅ API is stable" |