using System.Collections.Generic;
using YamlDotNet.Serialization;
public static void Main()
string[] notsafe = { "github.event.issue.title", "github.event.issue.body", "github.event.pull_request.title", "github.event.pull_request.body", "github.event.comment.body", "github.event.review.body", "github.event.review_comment.body", "github.event.pages", "github.event.commits", "github.event.head_commit.message", "github.event.head_commit.author.email", "github.event.head_commit.author.name", "github.event.pull_request.head.ref", "github.event.pull_request.head.label", "github.event.pull_request.head.repo.default_branch", "github.head_ref"};
var text = "name: Sync Key to Lokalise\non:\n pull_request:\n branches: [staging]\n types: [closed]\n\njobs:\n sync-main-app-key:\n if: github.event.pull_request.merged == true\n runs-on: ubuntu-latest\n container: ruby\n steps:\n - uses: actions/checkout@v2\n with:\n ref: ${{ github.head_ref }}\n - uses: actions/checkout@v2\n with:\n ref: staging\n fetch-depth: 2\n - run: >\n ruby sync_change.rb\n ${{ secrets.LOKALISE_PROJECT_ID }}\n ${{ github.head_ref }}\n ${{ secrets.LOKALISE_API_TOKEN }}\n main_app\n".Replace("\n", Environment.NewLine);
var r = new StringReader(text);
var deserializer = new Deserializer();
var r_obj = deserializer.Deserialize<dynamic>(r);
var yamlObject = r_obj["jobs"];
var serializer = new JsonSerializer();
var jobs = new List<String>();
foreach (var job in yamlObject)
foreach (var step in job["Value"]["steps"])
bool run = step.TryGetValue("run", out val);
string val_str = val.ToString();
foreach (var word in notsafe)
if (val_str.Contains(word))
serializer.Serialize(Console.Out, yamlObject[0]);