Skip to content

Commit

Permalink
try customizing branch name with github vars
Browse files Browse the repository at this point in the history
  • Loading branch information
kb-kerem committed Jul 18, 2024
1 parent ef55dfc commit 9c325a5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Build NUnit example
- name: Build XUnit example
uses: docker/build-push-action@v4
with:
context: ./dotnet-xunit
file: ./dotnet-xunit/Dockerfile
push: false
secrets: |
"dotenv=${{ secrets.DOTENV }}"
build-args:
- GITHUB_RUN_ID=${{ GITHUB_RUN_ID }}
- GITHUB_RUN_ATTEMPT=${{ GITHUB_RUN_ATTEMPT }}

nunit:
runs-on: ubuntu-latest
Expand All @@ -52,4 +55,4 @@ jobs:
file: ./dotnet-nunit/Dockerfile
push: false
secrets: |
"dotenv=${{ secrets.DOTENV }}"
"dotenv=${{ secrets.DOTENV }}"
4 changes: 4 additions & 0 deletions dotnet-nunit/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@ WORKDIR /workspace

COPY . .

ARG GITHUB_RUN_ID
ARG GITHUB_RUN_ATTEMPT
ARG SAUCE_VISUAL_BRANCH_NAME=${GITHUB_RUN_ID}${GITHUB_RUN_ATTEMPT}

RUN --mount=type=secret,id=dotenv,target=/workspace/.env env $(cat /workspace/.env | xargs) runme run dotnet-test
RUN --mount=type=secret,id=dotenv,target=/workspace/.env env $(cat /workspace/.env | xargs) runme run dotnet-test-modified
2 changes: 1 addition & 1 deletion dotnet-nunit/SauceLabs.Visual.Example/SauceDemo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task Setup()
{
Name = "My Visual Build",
Project = "csharp-project",
Branch = "csharp-branch"
Branch = Environment.GetEnvironmentVariable("SAUCE_VISUAL_BRANCH_NAME") ?? "main"
});
VisualClient.CaptureDom = true;
TestContext.Progress.WriteLine($"Build: {VisualClient.Build.Url}");
Expand Down

0 comments on commit 9c325a5

Please sign in to comment.