Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
|
5b06f30df9 | |
|
e33b594a5e |
4
pom.xml
4
pom.xml
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<groupId>nl.andrewl</groupId>
|
<groupId>nl.andrewl</groupId>
|
||||||
<artifactId>distribugit</artifactId>
|
<artifactId>distribugit</artifactId>
|
||||||
<version>1.3.0</version>
|
<version>1.3.1</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.kohsuke</groupId>
|
<groupId>org.kohsuke</groupId>
|
||||||
<artifactId>github-api</artifactId>
|
<artifactId>github-api</artifactId>
|
||||||
<version>1.303</version>
|
<version>1.306</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/info.picocli/picocli -->
|
<!-- https://mvnrepository.com/artifact/info.picocli/picocli -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -17,6 +17,16 @@ public interface RepositoryAction {
|
||||||
* An action which executes a system command, as handled by
|
* An action which executes a system command, as handled by
|
||||||
* {@link ProcessBuilder}. Note that the working directory of the command
|
* {@link ProcessBuilder}. Note that the working directory of the command
|
||||||
* is set to the directory of the repository.
|
* is set to the directory of the repository.
|
||||||
|
* <p>
|
||||||
|
* Commands invoked via this method have access to the following
|
||||||
|
* environment variables:
|
||||||
|
* </p>
|
||||||
|
* <ul>
|
||||||
|
* <li>DISTRIBUGIT_INVOKE_DIR - The directory in which distribugit
|
||||||
|
* was invoked.</li>
|
||||||
|
* <li>DISTRIBUGIT_WORKING_DIR - The working directory of distribugit,
|
||||||
|
* which contains all repositories.</li>
|
||||||
|
* </ul>
|
||||||
* @param command The command to run.
|
* @param command The command to run.
|
||||||
* @return The command action.
|
* @return The command action.
|
||||||
*/
|
*/
|
||||||
|
@ -24,6 +34,8 @@ public interface RepositoryAction {
|
||||||
return git -> {
|
return git -> {
|
||||||
ProcessBuilder pb = new ProcessBuilder(command);
|
ProcessBuilder pb = new ProcessBuilder(command);
|
||||||
pb.directory(git.getRepository().getWorkTree());
|
pb.directory(git.getRepository().getWorkTree());
|
||||||
|
pb.environment().put("DISTRIBUGIT_INVOKE_DIR", pb.directory().getParentFile().getParentFile().getAbsolutePath());
|
||||||
|
pb.environment().put("DISTRIBUGIT_WORKING_DIR", pb.directory().getParentFile().getAbsolutePath());
|
||||||
pb.inheritIO();
|
pb.inheritIO();
|
||||||
Process p = pb.start();
|
Process p = pb.start();
|
||||||
int result = p.waitFor();
|
int result = p.waitFor();
|
||||||
|
|
|
@ -27,10 +27,22 @@ public class DistribuGitCommand implements Callable<Integer> {
|
||||||
)
|
)
|
||||||
public String selectorExpression;
|
public String selectorExpression;
|
||||||
|
|
||||||
@CommandLine.Option(names = {"-a", "--action"}, description = "The command to run on each repository.", required = true)
|
@CommandLine.Option(
|
||||||
|
names = {"-a", "--action"},
|
||||||
|
description = """
|
||||||
|
The command to run on each repository.
|
||||||
|
Each command has access to the following environment variables:
|
||||||
|
- DISTRIBUGIT_INVOKE_DIR - The directory in which distribugit was invoked.
|
||||||
|
- DISTRIBUGIT_WORKING_DIR - The working directory of distribugit.
|
||||||
|
""",
|
||||||
|
required = true
|
||||||
|
)
|
||||||
public String actionCommand;
|
public String actionCommand;
|
||||||
|
|
||||||
@CommandLine.Option(names = {"-fa", "--finalization-action"}, description = "A command to run on each repository after all normal actions.")
|
@CommandLine.Option(
|
||||||
|
names = {"-fa", "--finalization-action"},
|
||||||
|
description = "A command to run on each repository after all normal actions. Has access to the same environment variables as --action."
|
||||||
|
)
|
||||||
public String finalizationActionCommand;
|
public String finalizationActionCommand;
|
||||||
|
|
||||||
@CommandLine.Option(names = {"-t", "--access-token"}, description = "The access token to use to perform operations.")
|
@CommandLine.Option(names = {"-t", "--access-token"}, description = "The access token to use to perform operations.")
|
||||||
|
|
Loading…
Reference in New Issue