diff --git a/.github/workflows/compliance_check.yml b/.github/workflows/compliance_check.yml index d8c0493d41a10527a406cc5a28e8cfadcc989847..c0e3000369513b8e2c05e4dcc6a8f14ea4d29dad 100644 --- a/.github/workflows/compliance_check.yml +++ b/.github/workflows/compliance_check.yml @@ -52,18 +52,13 @@ jobs: - name: send_compliance_slack_notification if: always() run: | - REPORT_CONTENT="" - if [ -f "compliance-report.md" ]; then - REPORT_CONTENT=$(cat "compliance-report.md") - fi - if [ "$COMPLIANCE_OUTCOME" == "success" ]; then STATUS="✅ Scheduled compliance check passed for $COMPLIANCE_TAG" else STATUS="⚠️ Scheduled compliance check failed for $COMPLIANCE_TAG" fi - MESSAGE=$(printf "%s\n\nReport: %s\nPRs needing review: %s\n\n%s" "$STATUS" "$ARTIFACT_URL" "https://github.com/zed-industries/zed/pulls?q=is%3Apr+is%3Aclosed+label%3A%22PR+state%3Aneeds+review%22" "$REPORT_CONTENT") + MESSAGE=$(printf "%s\n\nReport: %s\nPRs needing review: %s" "$STATUS" "$ARTIFACT_URL" "https://github.com/zed-industries/zed/pulls?q=is%3Apr+is%3Aclosed+label%3A%22PR+state%3Aneeds+review%22") curl -X POST -H 'Content-type: application/json' \ --data "$(jq -n --arg text "$MESSAGE" '{"text": $text}')" \ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b8a2c417c8a022be1a70b15ea89ba1b095d9c058..e21047c96bd9bd516e1013e8451c68d6fc7086b3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -315,6 +315,7 @@ jobs: env: GITHUB_APP_ID: ${{ secrets.ZED_ZIPPY_APP_ID }} GITHUB_APP_KEY: ${{ secrets.ZED_ZIPPY_APP_PRIVATE_KEY }} + continue-on-error: true - name: '@actions/upload-artifact compliance-report.md' if: always() uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 @@ -325,18 +326,13 @@ jobs: - name: send_compliance_slack_notification if: always() run: | - REPORT_CONTENT="" - if [ -f "compliance-report.md" ]; then - REPORT_CONTENT=$(cat "compliance-report.md") - fi - if [ "$COMPLIANCE_OUTCOME" == "success" ]; then STATUS="✅ Compliance check passed for $COMPLIANCE_TAG" else STATUS="❌ Compliance check failed for $COMPLIANCE_TAG" fi - MESSAGE=$(printf "%s\n\nReport: %s\nPRs needing review: %s\n\n%s" "$STATUS" "$ARTIFACT_URL" "https://github.com/zed-industries/zed/pulls?q=is%3Apr+is%3Aclosed+label%3A%22PR+state%3Aneeds+review%22" "$REPORT_CONTENT") + MESSAGE=$(printf "%s\n\nReport: %s\nPRs needing review: %s" "$STATUS" "$ARTIFACT_URL" "https://github.com/zed-industries/zed/pulls?q=is%3Apr+is%3Aclosed+label%3A%22PR+state%3Aneeds+review%22") curl -X POST -H 'Content-type: application/json' \ --data "$(jq -n --arg text "$MESSAGE" '{"text": $text}')" \ @@ -692,21 +688,17 @@ jobs: name: compliance-report.md path: compliance-report.md if-no-files-found: error + overwrite: true - name: send_compliance_slack_notification if: always() run: | - REPORT_CONTENT="" - if [ -f "compliance-report.md" ]; then - REPORT_CONTENT=$(cat "compliance-report.md") - fi - if [ "$COMPLIANCE_OUTCOME" == "success" ]; then STATUS="✅ Compliance check passed for $COMPLIANCE_TAG" else STATUS="❌ Compliance check failed for $COMPLIANCE_TAG" fi - MESSAGE=$(printf "%s\n\nReport: %s\nPRs needing review: %s\n\n%s" "$STATUS" "$ARTIFACT_URL" "https://github.com/zed-industries/zed/pulls?q=is%3Apr+is%3Aclosed+label%3A%22PR+state%3Aneeds+review%22" "$REPORT_CONTENT") + MESSAGE=$(printf "%s\n\nReport: %s\nPRs needing review: %s" "$STATUS" "$ARTIFACT_URL" "https://github.com/zed-industries/zed/pulls?q=is%3Apr+is%3Aclosed+label%3A%22PR+state%3Aneeds+review%22") curl -X POST -H 'Content-type: application/json' \ --data "$(jq -n --arg text "$MESSAGE" '{"text": $text}')" \ diff --git a/tooling/xtask/src/tasks/workflows/release.rs b/tooling/xtask/src/tasks/workflows/release.rs index 47e37f70dcb0542544ab0bce63a8a47fc4c851d2..007bee86151d303b00aebeaa091240508afacf39 100644 --- a/tooling/xtask/src/tasks/workflows/release.rs +++ b/tooling/xtask/src/tasks/workflows/release.rs @@ -156,6 +156,7 @@ const NEEDS_REVIEW_PULLS_URL: &str = "https://github.com/zed-industries/zed/pull pub(crate) enum ComplianceContext { Release, + ReleaseNonBlocking, Scheduled { tag_source: StepOutput }, } @@ -164,11 +165,16 @@ pub(crate) fn add_compliance_notification_steps( context: ComplianceContext, compliance_step_id: &str, ) -> gh_workflow::Job { - let upload_step = - upload_artifact(COMPLIANCE_REPORT_PATH).if_condition(Expression::new("always()")); + let upload_step = upload_artifact(COMPLIANCE_REPORT_PATH) + .if_condition(Expression::new("always()")) + .when(matches!(context, ComplianceContext::Release), |step| { + step.add_with(("overwrite", true)) + }); let (success_prefix, failure_prefix) = match context { - ComplianceContext::Release => ("✅ Compliance check passed", "❌ Compliance check failed"), + ComplianceContext::Release | ComplianceContext::ReleaseNonBlocking => { + ("✅ Compliance check passed", "❌ Compliance check failed") + } ComplianceContext::Scheduled { .. } => ( "✅ Scheduled compliance check passed", "⚠️ Scheduled compliance check failed", @@ -176,18 +182,13 @@ pub(crate) fn add_compliance_notification_steps( }; let script = formatdoc! {r#" - REPORT_CONTENT="" - if [ -f "{COMPLIANCE_REPORT_PATH}" ]; then - REPORT_CONTENT=$(cat "{COMPLIANCE_REPORT_PATH}") - fi - if [ "$COMPLIANCE_OUTCOME" == "success" ]; then STATUS="{success_prefix} for $COMPLIANCE_TAG" else STATUS="{failure_prefix} for $COMPLIANCE_TAG" fi - MESSAGE=$(printf "%s\n\nReport: %s\nPRs needing review: %s\n\n%s" "$STATUS" "$ARTIFACT_URL" "{NEEDS_REVIEW_PULLS_URL}" "$REPORT_CONTENT") + MESSAGE=$(printf "%s\n\nReport: %s\nPRs needing review: %s" "$STATUS" "$ARTIFACT_URL" "{NEEDS_REVIEW_PULLS_URL}") curl -X POST -H 'Content-type: application/json' \ --data "$(jq -n --arg text "$MESSAGE" '{{"text": $text}}')" \ @@ -206,7 +207,9 @@ pub(crate) fn add_compliance_notification_steps( .add_env(( "COMPLIANCE_TAG", match context { - ComplianceContext::Release => Context::github().ref_name().to_string(), + ComplianceContext::Release | ComplianceContext::ReleaseNonBlocking => { + Context::github().ref_name().to_string() + } ComplianceContext::Scheduled { tag_source } => tag_source.to_string(), }, )) @@ -227,6 +230,7 @@ fn compliance_check() -> NamedJob { .id("run-compliance-check") .add_env(("GITHUB_APP_ID", vars::ZED_ZIPPY_APP_ID)) .add_env(("GITHUB_APP_KEY", vars::ZED_ZIPPY_APP_PRIVATE_KEY)) + .continue_on_error(true) } let job = release_job(&[]) @@ -241,7 +245,7 @@ fn compliance_check() -> NamedJob { named::job(add_compliance_notification_steps( job, - ComplianceContext::Release, + ComplianceContext::ReleaseNonBlocking, "run-compliance-check", )) }