From 6b70b4ca8529cba46495ec4253a08ecdfbd5bb7e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= <rene.kijewski@fu-berlin.de>
Date: Thu, 14 Jul 2022 19:15:19 +0200
Subject: [PATCH] Add `rustc_hash` output

I.e. the `a8314ef7d` part in `rustc 1.62.0 (a8314ef7d 2022-06-27)`.
This makes it possible to use the output e.g. as a cache key.
`actions-rs/toolchain` has the same output with the same function.
---
 action.yml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/action.yml b/action.yml
index 5b9d18e..b3334d0 100644
--- a/action.yml
+++ b/action.yml
@@ -18,8 +18,11 @@ inputs:
 
 outputs:
   version:
-    description: Version as reported by `rustc --version`
+    description: Version as reported by `rustc --version`, e.g. "rustc 1.62.0 (a8314ef7d 2022-06-27)"
     value: ${{steps.rustc-version.outputs.version}}
+  rustc_hash:
+    description: The rustc hash, e.g. "a8314ef7d"
+    value: ${{steps.rustc-hash.outputs.hash}}
 
 runs:
   using: composite
@@ -50,5 +53,8 @@ runs:
     - id: rustc-version
       run: echo "::set-output name=version::$(rustc --version)"
       shell: bash
+    - id: rustc-hash
+      run: echo "::set-output name=hash::$(rustc --version | cut -d'(' -f2 -| cut -d' ' -f1)"
+      shell: bash
     - run: rustc --version
       shell: bash