Skip to content

Commit a9aa74a

Browse files
committed
Change trigger to backreference the requesting PR number
1 parent f26664b commit a9aa74a

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

trigger.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
#!/bin/bash
22

3-
body='{
4-
"request": {
5-
"branch":"build"
3+
cat << RUBY | ruby -r json
4+
target =
5+
if ENV["TRAVIS_COMMIT_MESSAGE"].to_s =~ /\AMerge pull request (#\d+)/
6+
"#{ENV["TRAVIS_REPO_SLUG"]}#{\$1}"
7+
else
8+
"#{ENV["TRAVIS_REPO_SLUG"]}@#{ENV["TRAVIS_COMMIT"]} (#{ENV["TRAVIS_BRANCH"]})"
9+
end
10+
File.write("/tmp/post.json", {
11+
"request" => {
12+
"branch" => "build",
13+
"message" => "Deployed site for #{target}"
614
}
7-
}'
15+
}.to_json)
16+
RUBY
817

918
curl -s -X POST \
1019
-H "Content-Type: application/json" \
1120
-H "Accept: application/json" \
1221
-H "Travis-API-Version: 3" \
1322
-H "Authorization: token $TRAVIS_TOKEN" \
14-
-d "$body" \
23+
-d @/tmp/post.json \
1524
https://api.travis-ci.org/repo/ManageIQ%2Fmanageiq.github.io/requests

0 commit comments

Comments
 (0)