Skip to content

Commit 6eff5ea

Browse files
authored
Remove tj-actions usage, eventhough we had it pinned as gitref (#753)
1 parent ce23e31 commit 6eff5ea

File tree

2 files changed

+16
-23
lines changed

2 files changed

+16
-23
lines changed

.github/workflows/preview-build.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,8 @@ jobs:
5757
with:
5858
ref: ${{ github.event.pull_request.head.sha || github.ref }}
5959

60-
- name: Get changed files
61-
if: contains(fromJSON('["merge_group", "pull_request", "pull_request_target"]'), github.event_name)
62-
id: check-files
63-
uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6
64-
with:
65-
files: ${{ inputs.path-pattern != '' && inputs.path-pattern || '**' }}
66-
6760
- name: Checkout
68-
if: startsWith(github.event_name, 'pull_request') && steps.check-files.outputs.any_modified == 'true'
61+
if: startsWith(github.event_name, 'pull_request')
6962
uses: actions/checkout@v4
7063
with:
7164
ref: ${{ github.event.pull_request.head.sha || github.ref }}
@@ -77,7 +70,7 @@ jobs:
7770
tool-cache: false
7871

7972
- name: Create Deployment
80-
if: github.event_name == 'push' || (steps.check-files.outputs.any_modified == 'true' && startsWith(github.event_name, 'pull_request'))
73+
if: github.event_name == 'push' || startsWith(github.event_name, 'pull_request')
8174
uses: actions/github-script@v7
8275
id: deployment
8376
env:
@@ -144,7 +137,7 @@ jobs:
144137
dotnet run --project src/docs-builder -- --strict --path-prefix "${PATH_PREFIX}"
145138
146139
- name: Build documentation
147-
if: github.repository != 'elastic/docs-builder' && (steps.deployment.outputs.result || (steps.check-files.outputs.any_modified == 'true' && github.event_name == 'merge_group'))
140+
if: github.repository != 'elastic/docs-builder' && (steps.deployment.outputs.result || github.event_name == 'merge_group')
148141
uses: elastic/docs-builder@main
149142
id: docs-build
150143
continue-on-error: ${{ fromJSON(inputs.continue-on-error != '' && inputs.continue-on-error || 'false') }}
@@ -154,7 +147,7 @@ jobs:
154147
metadata-only: ${{ fromJSON(inputs.metadata-only != '' && inputs.metadata-only || 'true') }}
155148

156149
- name: 'Validate Inbound Links'
157-
if: ${{ !cancelled() && steps.docs-build.outputs.skip != 'true' && (steps.deployment.outputs.result || (steps.check-files.outputs.any_modified == 'true' && github.event_name == 'merge_group')) }}
150+
if: ${{ !cancelled() && steps.docs-build.outputs.skip != 'true' && (steps.deployment.outputs.result || github.event_name == 'merge_group') }}
158151
uses: elastic/docs-builder/actions/validate-inbound-local@main
159152

160153
- uses: elastic/docs-builder/.github/actions/aws-auth@main

src/docs-assembler/Sourcing/RepositorySourcesFetcher.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,28 +89,28 @@ private Checkout CloneOrUpdateRepository(Repository repository, string name, Con
8989
{
9090
_logger.LogInformation("Pull: {Name}\t{Repository}\t{RelativePath}", name, repository, relativePath);
9191
// --allow-unrelated-histories due to shallow clones not finding a common ancestor
92-
ExecIn(name, checkoutFolder, "git", "pull", "--depth", "1", "--allow-unrelated-histories", "--no-ff");
92+
ExecIn(checkoutFolder, "git", "pull", "--depth", "1", "--allow-unrelated-histories", "--no-ff");
9393
head = Capture(checkoutFolder, "git", "rev-parse", "HEAD");
9494
}
9595
else
9696
{
9797
_logger.LogInformation("Checkout: {Name}\t{Repository}\t{RelativePath}", name, repository, relativePath);
9898
if (repository.CheckoutStrategy == "full")
9999
{
100-
Exec(name, "git", "clone", repository.Origin, checkoutFolder.FullName,
100+
Exec("git", "clone", repository.Origin, checkoutFolder.FullName,
101101
"--depth", "1", "--single-branch",
102102
"--branch", repository.CurrentBranch
103103
);
104104
}
105105
else if (repository.CheckoutStrategy == "partial")
106106
{
107-
Exec(name,
107+
Exec(
108108
"git", "clone", "--filter=blob:none", "--no-checkout", repository.Origin, checkoutFolder.FullName
109109
);
110110

111-
ExecIn(name, checkoutFolder, "git", "sparse-checkout", "set", "--cone");
112-
ExecIn(name, checkoutFolder, "git", "checkout", repository.CurrentBranch);
113-
ExecIn(name, checkoutFolder, "git", "sparse-checkout", "set", "docs");
111+
ExecIn(checkoutFolder, "git", "sparse-checkout", "set", "--cone");
112+
ExecIn(checkoutFolder, "git", "checkout", repository.CurrentBranch);
113+
ExecIn(checkoutFolder, "git", "sparse-checkout", "set", "docs");
114114
head = Capture(checkoutFolder, "git", "rev-parse", "HEAD");
115115
}
116116
}
@@ -125,17 +125,17 @@ private Checkout CloneOrUpdateRepository(Repository repository, string name, Con
125125
};
126126
}
127127

128-
private void Exec(string name, string binary, params string[] args) => ExecIn(name, null, binary, args);
128+
private void Exec(string binary, params string[] args) => ExecIn(null, binary, args);
129129

130-
private void ExecIn(string name, IDirectoryInfo? workingDirectory, string binary, params string[] args)
130+
private void ExecIn(IDirectoryInfo? workingDirectory, string binary, params string[] args)
131131
{
132-
var arguments = new StartArguments(binary, args)
132+
var arguments = new ExecArguments(binary, args)
133133
{
134134
WorkingDirectory = workingDirectory?.FullName
135135
};
136-
var result = Proc.StartRedirected(arguments, new ConsoleLineHandler(_logger, name));
137-
if (result.ExitCode != 0)
138-
context.Collector.EmitError("", $"Exit code: {result.ExitCode} while executing {binary} {string.Join(" ", args)} in {workingDirectory}");
136+
var result = Proc.Exec(arguments);
137+
if (result != 0)
138+
context.Collector.EmitError("", $"Exit code: {result} while executing {binary} {string.Join(" ", args)} in {workingDirectory}");
139139
}
140140

141141
private string Capture(IDirectoryInfo? workingDirectory, string binary, params string[] args)

0 commit comments

Comments
 (0)