Skip to content

Commit

Permalink
Merge PR #178 from webwarrior-ws/fix-pr177
Browse files Browse the repository at this point in the history
FileConventions: account for .env prefix when checking versions
in yaml files.

This should have been done in PR177.
  • Loading branch information
knocte authored Nov 6, 2024
2 parents 92e1ef8 + 36d807b commit 897fa58
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CI

on: [push, pull_request]

env:
PULUMI_VERSION: 2.0.0

jobs:
jobA:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
with:
pulumi-version: ${{ env.PULUMI_VERSION }}
- name: Print "Hello World!"
run: echo "Hello World!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CI

on: [push, pull_request]

env:
PULUMI_VERSION: 2.0.1

jobs:
jobA:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
with:
pulumi-version: ${{ env.PULUMI_VERSION }}
- name: Print "Hello World!"
run: echo "Hello World!"
12 changes: 12 additions & 0 deletions src/FileConventions.Test/FileConventions.Test.fs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,18 @@ let DetectInconsistentVersionsInGitHubCI2() =

Assert.That(DetectInconsistentVersionsInGitHubCI fileInfo, Is.EqualTo true)

[<Test>]
let DetectInconsistentVersionsInGitHubCI3() =
let fileInfo =
DirectoryInfo(
Path.Combine(
dummyFilesDirectory.FullName,
"DummyWorkflowsWithEnvPrefixed"
)
)

Assert.That(DetectInconsistentVersionsInGitHubCI fileInfo, Is.EqualTo true)

[<Test>]
let DetectInconsistentVersionsInNugetRefsInFSharpScripts1() =
let fileInfos =
Expand Down
8 changes: 7 additions & 1 deletion src/FileConventions/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,15 @@ let private DetectInconsistentVersionsInYamlFiles
yamlDict.Children.["env"]
:?> YamlMappingNode

let envVarName =
let referenceString =
variableRegexMatch.Groups.[1].Value

let envVarName =
if referenceString.StartsWith "env." then
referenceString.[4..]
else
referenceString

match envDict.Children.TryGetValue envVarName
with
| true, envVarValue ->
Expand Down

0 comments on commit 897fa58

Please sign in to comment.