예제 #1
0
        public TemplateSchema CreateSchema()
        {
            var assembly = Assembly.GetExecutingAssembly();
            var json     = default(String);

            using (var stream = assembly.GetManifestResourceStream("GitHub.DistributedTask.Pipelines.ObjectTemplating.workflow-v1.0.json"))
                using (var streamReader = new StreamReader(stream))
                {
                    json = streamReader.ReadToEnd();
                }

            var objectReader = new JsonObjectReader(null, json);

            return(TemplateSchema.Load(objectReader));
        }
예제 #2
0
        public override void Initialize(IHostContext hostContext)
        {
            base.Initialize(hostContext);

            var assembly = Assembly.GetExecutingAssembly();
            var json     = default(string);

            using (var stream = assembly.GetManifestResourceStream("GitHub.Runner.Worker.action_yaml.json"))
                using (var streamReader = new StreamReader(stream))
                {
                    json = streamReader.ReadToEnd();
                }

            var objectReader = new JsonObjectReader(null, json);

            _actionManifestSchema = TemplateSchema.Load(objectReader);
            ArgUtil.NotNull(_actionManifestSchema, nameof(_actionManifestSchema));
            Trace.Info($"Load schema file with definitions: {StringUtil.ConvertToJson(_actionManifestSchema.Definitions.Keys)}");
        }
예제 #3
0
        public static TemplateSchema GetSchema()
        {
            if (s_schema == null)
            {
                var assembly = Assembly.GetExecutingAssembly();
                var json     = default(String);
                using (var stream = assembly.GetManifestResourceStream("GitHub.DistributedTask.Pipelines.ObjectTemplating.workflow-v1.0.json"))
                    using (var streamReader = new StreamReader(stream))
                    {
                        json = streamReader.ReadToEnd();
                    }

                var objectReader = new JsonObjectReader(null, json);
                var schema       = TemplateSchema.Load(objectReader);
                Interlocked.CompareExchange(ref s_schema, schema, null);
            }

            return(s_schema);
        }