Skip to content

Commit bd300ee

Browse files
enable yaml anchors in workflow parser (#624)
1 parent c5e16b1 commit bd300ee

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

.github/workflows/nuget.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ jobs:
191191
Runner.Client --event azpipelines -C testworkflows/azpipelines/extend-variables -W testworkflows/azpipelines/extend-variables/pipeline.yml
192192
Runner.Client --event azpipelines -C testworkflows/azpipelines/runoncedeploycheckout -W testworkflows/azpipelines/runoncedeploycheckout/pipeline.yml --local-repository az/fork@main=testworkflows/azpipelines
193193
Runner.Client --event azpipelines -C testworkflows/azpipelines/nuget-restore-task -W testworkflows/azpipelines/nuget-restore-task/pipeline.yml
194+
Runner.Client -W testworkflows/verify-yaml-anchors.yml
194195
- name: Windows Container Change Firewall Settings
195196
if: contains(matrix.os, 'windows') && !job.container
196197
run: |

src/Runner.Server/Controllers/MessageController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ private HookResponse ConvertYaml2(string fileRelativePath, string content, strin
750750
var fileContent = content ?? System.IO.File.ReadAllText(fileRelativePath);
751751
using (var stringReader = new StringReader(fileContent))
752752
{
753-
var yamlObjectReader = new YamlObjectReader(fileId, stringReader, workflowContext.HasFeature("system.runner.server.yaml.anchors"), workflowContext.HasFeature("system.runner.server.yaml.fold"), workflowContext.HasFeature("system.runner.server.yaml.merge"));
753+
var yamlObjectReader = new YamlObjectReader(fileId, stringReader, workflowContext.HasFeature("system.runner.server.yaml.anchors", true /* https://github.com/actions/runner/issues/1182#issuecomment-3150797791 now true */), workflowContext.HasFeature("system.runner.server.yaml.fold"), workflowContext.HasFeature("system.runner.server.yaml.merge"));
754754
token = TemplateReader.Read(templateContext, workflowContext.HasFeature("system.runner.server.strictValidation") ? "workflow-root-strict" : "workflow-root", yamlObjectReader, fileId, out _);
755755
}
756756

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
on: push
2+
jobs:
3+
job-with-condition:
4+
runs-on: &label
5+
self-hosted
6+
if: success() || success('joba', 'jobb') || failure() || failure('joba', 'jobb') || always() || cancelled()
7+
steps: &steps
8+
- run: exit 0
9+
then:
10+
runs-on: *label
11+
steps:
12+
- run: exit 0

0 commit comments

Comments
 (0)