From 6ca71f79589570110597c557d98b647113955e25 Mon Sep 17 00:00:00 2001
From: Jeevan Singh Opel <jeevan.opel@snowflake.com>
Date: Mon, 2 Dec 2024 20:08:45 +0000
Subject: [PATCH] Add workflow

---
 .github/workflows/check-vendor.yml | 32 ++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 .github/workflows/check-vendor.yml

diff --git a/.github/workflows/check-vendor.yml b/.github/workflows/check-vendor.yml
new file mode 100644
index 0000000..dc521fb
--- /dev/null
+++ b/.github/workflows/check-vendor.yml
@@ -0,0 +1,32 @@
+# This workflow will delete and regenerate the opentelemetry-exporter-otlp-proto-common code using scripts/vendor_otlp_proto_common.sh.
+# If generating the code produces any changes from what is currently checked in, the workflow will fail and prompt the user to regenerate the code.
+# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
+
+name: Check OTLP Proto Common Vendored Code
+
+on:
+  push:
+    branches: [ "main" ]
+    paths:
+      - "scripts/vendor_otlp_proto_common.sh"
+      - "src/snowflake/telemetry/_internal/opentelemetry/exporter/**"
+      - ".github/workflows/check-vendor.yml"
+  pull_request:
+    branches: [ "main" ]
+    paths:
+      - "scripts/vendor_otlp_proto_common.sh"
+      - "src/snowflake/telemetry/_internal/opentelemetry/exporter/**"
+      - ".github/workflows/check-vendor.yml"
+
+jobs:
+  check-codegen:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v3
+    - name: Run vendor script
+      run: |
+        rm -rf src/snowflake/telemetry/_internal/opentelemetry/exporter/
+        ./scripts/vendor_otlp_proto_common.sh
+    - name: Check for changes
+      run: |
+        git diff --exit-code || { echo "Code generation produced changes! Regenerate the code using ./scripts/vendor_otlp_proto_common.sh"; exit 1; }