From 0b8508387167a50a91be4c0c12402d66ca839325 Mon Sep 17 00:00:00 2001
From: 1xstj <106580853+1xstj@users.noreply.github.com>
Date: Thu, 5 Dec 2024 16:04:16 +0000
Subject: [PATCH] chore : generate pre-release on PR merge (#846)

---
 .github/workflows/pre-release.yml | 35 +++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 .github/workflows/pre-release.yml

diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml
new file mode 100644
index 00000000..74ebcee2
--- /dev/null
+++ b/.github/workflows/pre-release.yml
@@ -0,0 +1,35 @@
+name: Create Pre-release
+
+on:
+  push:
+    branches:
+      - main
+
+jobs:
+  create-pre-release:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: write
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
+
+      - name: Get commit info
+        id: commit_info
+        run: |
+          echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
+          echo "commit_message=$(git log -1 --pretty=%B)" >> $GITHUB_OUTPUT
+
+      - name: Create pre-release
+        uses: actions/create-release@v1
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        with:
+          tag_name: ${{ steps.commit_info.outputs.sha_short }}
+          release_name: Tangle Pre-release ${{ steps.commit_info.outputs.sha_short }}
+          body: |
+            Commit: ${{ steps.commit_info.outputs.commit_message }}
+          draft: false
+          prerelease: true