Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better docs for build:comment:add:commit and build:comment:add:pr #285

Merged
merged 3 commits into from Sep 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 23 additions & 1 deletion README.md
Expand Up @@ -156,6 +156,8 @@ Additional options are available to further customize the `build:project:repair`

The `build:comment:add:commit` command is used to add a comment to a commit on the Git Provider. This is useful in CI scripts for commenting as multidev environments are created or other code feedback is determined.

Either the `--message` and/or the `--site_url` options are required.

#### Command Options

Additional options are available to customize the `build:comment:add:commit` command:
Expand All @@ -165,7 +167,23 @@ Additional options are available to customize the `build:comment:add:commit` com
| --sha | The SHA hash of the commit to add the comment to |
| --message | The message to post to the commit |
| --site_url | If provided, will include a "Visit Site" link at the start of the comment, linking to the provided site URL |


### terminus build:comment:add:pr

The `build:comment:add:pr` command is used to add a comment to a pull request on the Git Provider. This is useful in CI scripts for commenting as multidev environments are created or other code feedback is determined.

The `--pr_id` option and either the `--message` and/or the `--site_url` options are required.

#### Command Options

Additional options are available to customize the `build:comment:add:pr` command:

| Option | Description |
| ---------------- | ---------------- |
| --pr_id | Required. The number of the pull request to add the comment to |
| --message | The message to post to the pull request |
| --site_url | If provided, will include a "Visit Site" link at the start of the pull request, linking to the provided site URL |

### build:credentials:clear

The `build:credentials:clear` command is available to clear cached credentials from Build Tools. This is useful when developing Build Tools or trying to remove credentials from a machine.
Expand Down Expand Up @@ -417,6 +435,10 @@ This command will commit the generated artifacts to an existing multidev environ

`terminus build:env:list`

### Commenting on a pull request or merge request

`terminus build:comment:add:pr --pr_number=123 --message="Behat tests passed!"`

## Help
Run `terminus list build` for a complete list of available commands. Use `terminus help <command>` to get help on one command.

Expand Down
4 changes: 4 additions & 0 deletions src/Commands/CommentAddCommitCommand.php
Expand Up @@ -9,6 +9,8 @@

namespace Pantheon\TerminusBuildTools\Commands;

use Pantheon\Terminus\Exceptions\TerminusException;

/**
* Commit Comment Command
*/
Expand Down Expand Up @@ -53,6 +55,8 @@ public function commentAddCommit(
// Submit message
$targetProject = $this->projectFromRemoteUrl($remoteUrlFromGit);
$this->git_provider->commentOnCommit($targetProject, $commitHash, $message);
} else {
throw new TerminusException( '--message and/or --site_url are required.' );
}
}
}
2 changes: 2 additions & 0 deletions src/Commands/CommentAddPullRequestCommand.php
Expand Up @@ -55,6 +55,8 @@ public function commentAddPullRequest(
// Submit message
$targetProject = $this->projectFromRemoteUrl($remoteUrlFromGit);
$this->git_provider->commentOnPullRequest($targetProject, $prId, $message);
} else {
throw new TerminusException( '--message and/or --site_url are required.' );
}
}
}