fix: fix compliance report file upload (#53424)

Dino and Conrad Irwin created

Release Notes:

- N/A

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>

Change summary

.github/workflows/compliance_check.yml       |  8 ++++----
.github/workflows/release.yml                | 16 ++++++++--------
tooling/xtask/src/tasks/workflows/release.rs |  9 ++++-----
3 files changed, 16 insertions(+), 17 deletions(-)

Detailed changes

.github/workflows/compliance_check.yml 🔗

@@ -37,7 +37,7 @@ jobs:
       name: compliance_check::scheduled_compliance_check::run_compliance_check
       run: |
         echo "tag=$LATEST_TAG" >> "$GITHUB_OUTPUT"
-        cargo xtask compliance "$LATEST_TAG" --branch main --report-path compliance-report
+        cargo xtask compliance "$LATEST_TAG" --branch main --report-path compliance-report.md
       env:
         LATEST_TAG: ${{ steps.determine-version.outputs.tag }}
         GITHUB_APP_ID: ${{ secrets.ZED_ZIPPY_APP_ID }}
@@ -47,14 +47,14 @@ jobs:
       uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
       with:
         name: compliance-report.md
-        path: target/compliance-report.md
+        path: compliance-report.md
         if-no-files-found: error
     - name: send_compliance_slack_notification
       if: always()
       run: |
         REPORT_CONTENT=""
-        if [ -f "target/compliance-report.md" ]; then
-            REPORT_CONTENT=$(cat "target/compliance-report.md")
+        if [ -f "compliance-report.md" ]; then
+            REPORT_CONTENT=$(cat "compliance-report.md")
         fi
 
         if [ "$COMPLIANCE_OUTCOME" == "success" ]; then

.github/workflows/release.yml 🔗

@@ -311,7 +311,7 @@ jobs:
     - id: run-compliance-check
       name: release::compliance_check::run_compliance_check
       run: |
-        cargo xtask compliance "$GITHUB_REF_NAME" --report-path compliance-report
+        cargo xtask compliance "$GITHUB_REF_NAME" --report-path compliance-report.md
       env:
         GITHUB_APP_ID: ${{ secrets.ZED_ZIPPY_APP_ID }}
         GITHUB_APP_KEY: ${{ secrets.ZED_ZIPPY_APP_PRIVATE_KEY }}
@@ -320,14 +320,14 @@ jobs:
       uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
       with:
         name: compliance-report.md
-        path: target/compliance-report.md
+        path: compliance-report.md
         if-no-files-found: error
     - name: send_compliance_slack_notification
       if: always()
       run: |
         REPORT_CONTENT=""
-        if [ -f "target/compliance-report.md" ]; then
-            REPORT_CONTENT=$(cat "target/compliance-report.md")
+        if [ -f "compliance-report.md" ]; then
+            REPORT_CONTENT=$(cat "compliance-report.md")
         fi
 
         if [ "$COMPLIANCE_OUTCOME" == "success" ]; then
@@ -681,7 +681,7 @@ jobs:
     - id: run-post-upload-compliance-check
       name: release::validate_release_assets::run_post_upload_compliance_check
       run: |
-        cargo xtask compliance "$GITHUB_REF_NAME" --report-path compliance-report
+        cargo xtask compliance "$GITHUB_REF_NAME" --report-path compliance-report.md
       env:
         GITHUB_APP_ID: ${{ secrets.ZED_ZIPPY_APP_ID }}
         GITHUB_APP_KEY: ${{ secrets.ZED_ZIPPY_APP_PRIVATE_KEY }}
@@ -690,14 +690,14 @@ jobs:
       uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
       with:
         name: compliance-report.md
-        path: target/compliance-report.md
+        path: compliance-report.md
         if-no-files-found: error
     - name: send_compliance_slack_notification
       if: always()
       run: |
         REPORT_CONTENT=""
-        if [ -f "target/compliance-report.md" ]; then
-            REPORT_CONTENT=$(cat "target/compliance-report.md")
+        if [ -f "compliance-report.md" ]; then
+            REPORT_CONTENT=$(cat "compliance-report.md")
         fi
 
         if [ "$COMPLIANCE_OUTCOME" == "success" ]; then

tooling/xtask/src/tasks/workflows/release.rs 🔗

@@ -151,8 +151,7 @@ pub(crate) fn create_sentry_release() -> Step<Use> {
     .add_with(("environment", "production"))
 }
 
-pub(crate) const COMPLIANCE_REPORT_PATH: &str = "compliance-report";
-const COMPLIANCE_REPORT_FILE: &str = "target/compliance-report.md";
+pub(crate) const COMPLIANCE_REPORT_PATH: &str = "compliance-report.md";
 const NEEDS_REVIEW_PULLS_URL: &str = "https://github.com/zed-industries/zed/pulls?q=is%3Apr+is%3Aclosed+label%3A%22PR+state%3Aneeds+review%22";
 
 pub(crate) enum ComplianceContext {
@@ -166,7 +165,7 @@ pub(crate) fn add_compliance_notification_steps(
     compliance_step_id: &str,
 ) -> gh_workflow::Job {
     let upload_step =
-        upload_artifact(COMPLIANCE_REPORT_FILE).if_condition(Expression::new("always()"));
+        upload_artifact(COMPLIANCE_REPORT_PATH).if_condition(Expression::new("always()"));
 
     let (success_prefix, failure_prefix) = match context {
         ComplianceContext::Release => ("✅ Compliance check passed", "❌ Compliance check failed"),
@@ -178,8 +177,8 @@ pub(crate) fn add_compliance_notification_steps(
 
     let script = formatdoc! {r#"
         REPORT_CONTENT=""
-        if [ -f "{COMPLIANCE_REPORT_FILE}" ]; then
-            REPORT_CONTENT=$(cat "{COMPLIANCE_REPORT_FILE}")
+        if [ -f "{COMPLIANCE_REPORT_PATH}" ]; then
+            REPORT_CONTENT=$(cat "{COMPLIANCE_REPORT_PATH}")
         fi
 
         if [ "$COMPLIANCE_OUTCOME" == "success" ]; then