Skip to content
This repository was archived by the owner on Nov 8, 2018. It is now read-only.

Commit 5ac7855

Browse files
committed
Add delete label parameter
1 parent 348d93d commit 5ac7855

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ Set the status message for `concourse-ci` context on specified pull request.
187187

188188
* `label`: *Optional.* A label to add to the pull request.
189189

190+
* `delete_label`: *Optional.* A label to remove from the pull request.
191+
190192
## Example pipeline
191193

192194
Please see this repo's [pipeline](https://github.com/jtarchie/pullrequest-resource/blob/master/.concourse.yml) for a perfect example.

assets/lib/commands/out.rb

+11
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ def output
7171
metadata << { 'name' => 'label', 'value' => params.label }
7272
end
7373

74+
if params.delete_label
75+
label_exists = Octokit.labels_for_issue(input.source.repo, id).select do |hash|
76+
hash.to_hash[:name] == params.delete_label
77+
end
78+
79+
if label_exists.any?
80+
Octokit.remove_label(input.source.repo, id, params.delete_label)
81+
end
82+
metadata << { 'name' => 'delete_label', 'value' => params.delete_label }
83+
end
84+
7485
if params.merge.method
7586
commit_msg = if params.merge.commit_msg
7687
commit_path = File.join(destination, params.merge.commit_msg)

0 commit comments

Comments
 (0)