compliance_check.yml

 1# Generated from xtask::workflows::compliance_check
 2# Rebuild with `cargo xtask workflows`.
 3name: compliance_check
 4env:
 5  CARGO_TERM_COLOR: always
 6on:
 7  schedule:
 8  - cron: 30 17 * * 2
 9jobs:
10  scheduled_compliance_check:
11    if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions')
12    runs-on: namespace-profile-2x4-ubuntu-2404
13    steps:
14    - name: steps::checkout_repo
15      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
16      with:
17        clean: false
18        fetch-depth: 0
19    - name: steps::cache_rust_dependencies_namespace
20      uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
21      with:
22        cache: rust
23        path: ~/.rustup
24    - id: determine-version
25      name: compliance_check::scheduled_compliance_check
26      run: |
27        VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' crates/zed/Cargo.toml | tr -d '[:space:]')
28        if [ -z "$VERSION" ]; then
29            echo "Could not determine version from crates/zed/Cargo.toml"
30            exit 1
31        fi
32        TAG="v${VERSION}-pre"
33        echo "Checking compliance for $TAG"
34        echo "tag=$TAG" >> "$GITHUB_OUTPUT"
35    - id: run-compliance-check
36      name: compliance_check::scheduled_compliance_check::run_compliance_check
37      run: cargo xtask compliance "$LATEST_TAG" --branch main --report-path target/compliance-report
38      env:
39        LATEST_TAG: ${{ steps.determine-version.outputs.tag }}
40        GITHUB_APP_ID: ${{ secrets.ZED_ZIPPY_APP_ID }}
41        GITHUB_APP_KEY: ${{ secrets.ZED_ZIPPY_APP_PRIVATE_KEY }}
42    - name: compliance_check::scheduled_compliance_check::send_failure_slack_notification
43      if: failure()
44      run: |
45        MESSAGE="⚠️ Scheduled compliance check failed for upcoming preview release $LATEST_TAG: There are PRs with missing reviews."
46
47        curl -X POST -H 'Content-type: application/json' \
48            --data "$(jq -n --arg text "$MESSAGE" '{"text": $text}')" \
49            "$SLACK_WEBHOOK"
50      env:
51        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_WORKFLOW_FAILURES }}
52        LATEST_TAG: ${{ steps.determine-version.outputs.tag }}
53defaults:
54  run:
55    shell: bash -euxo pipefail {0}