From 7c95834b7bf194d0ee0851ee23d6257317020cb2 Mon Sep 17 00:00:00 2001
From: Novus Nota <68142933+novusnota@users.noreply.github.com>
Date: Tue, 2 Dec 2025 18:30:09 +0100
Subject: [PATCH] languages: Add injections to highlight script blocks of
`actions/github-script` as JavaScript (#43771)
Hello, this is my first time contributing here! The issue creation
button noted that "feature request"-esque items should go to
discussions, so with this PR, I'm closing that discussion and not an
issue. I hope that's ok :)
---
Closes https://github.com/zed-industries/zed/discussions/43769
Preview:

Release Notes:
- Added JavaScript highlighting via YAML `injections.scm` for script
blocks of `actions/github-script`
---
crates/languages/src/yaml/injections.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/crates/languages/src/yaml/injections.scm b/crates/languages/src/yaml/injections.scm
index 9117c713b98fdd2896b13e4949a77c6489b9ee36..c9de25a18f8afb7d8e0c6874401798edede9bce1 100644
--- a/crates/languages/src/yaml/injections.scm
+++ b/crates/languages/src/yaml/injections.scm
@@ -1,3 +1,25 @@
((comment) @injection.content
(#set! injection.language "comment")
)
+
+; GitHub actions: JavaScript for workflow scripting (inline and block)
+(block_mapping
+ (block_mapping_pair
+ key: (flow_node) @_uses (#eq? @_uses "uses")
+ value: (flow_node) @_actions_ghs (#match? @_actions_ghs "^actions/github-script"))
+ (block_mapping_pair
+ key: (flow_node) @_with (#eq? @_with "with")
+ value: (block_node
+ (block_mapping
+ (block_mapping_pair
+ key: (flow_node) @_run (#eq? @_run "script")
+ value: [
+ (flow_node (plain_scalar (string_scalar) @injection.content))
+ (block_node (block_scalar) @injection.content)
+ ]
+ (#set! injection.language "javascript")
+ )
+ )
+ )
+ )
+)