tag:help.appveyor.com,2012-11-13:/discussions/questions/23891-how-can-i-use-parameters-from-webhook-call-from-github-in-buildAppVeyor: Discussion 2018-10-09T21:00:36Ztag:help.appveyor.com,2012-11-13:Comment/458456342018-08-06T04:37:33Z2018-08-06T04:37:47Zhow can I use parameters from webhook call from GitHub in build?<div><p>Check out the <strong>NOTE:</strong> section in <a href="https://www.appveyor.com/docs/deployment/github/#promoting-selected-tag-to-github-release">this part of the docs</a>. I think it describes pretty precisely your scenario.</p>
<p>Basically, you can have a <code>tag: $(APPVEYOR_REPO_TAG_NAME)</code> entry in your deployment settings.</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/458456342018-08-06T21:32:39Z2018-08-06T21:53:45Zhow can I use parameters from webhook call from GitHub in build?<div><p>Thanks, that looked promising, so I added a <code>tag:</code> value, per<br></p>
<pre>
<code>deploy:
provider: GitHub
force_update: true
tag: $(APPVEYOR_REPO_TAG_NAME)
auth_token:
secure: xxx</code>
</pre>
Unfortunately, the <code>$</code> reference did not get expanded, and I ended up with a new release with literally the name <code>$(APPVEYOR_REPO_TAG_NAME)</code>. From the appveyor log:<br>
<pre>
<code>Deploying using GitHub provider
Creating "$(APPVEYOR_REPO_TAG_NAME)" release for repository "adafruit/Adafruit_nRF52_nrfutil" tag "$(APPVEYOR_REPO_TAG_NAME)" commit "713ec9b1c44962fe412806c45a08916bbfc00723"...OK
Uploading "adafruit-nrfutil.exe" to release assets...OK
Updating "$(APPVEYOR_REPO_TAG_NAME)" release for repository "adafruit/Adafruit_nRF52_nrfutil" tag "$(APPVEYOR_REPO_TAG_NAME)" commit "713ec9b1c44962fe412806c45a08916bbfc00723"...OK</code>
</pre>
(I've since deleted that oddly-named release.)
<p>Full appveyor.yml is here: <a href="https://github.com/adafruit/Adafruit_nRF52_nrfutil/blob/master/appveyor.yml">https://github.com/adafruit/Adafruit_nRF52_nrfutil/blob/master/appv...</a>. I think it should work, but ...</p>
<p>EDIT: Similar issue here: <a href="https://help.appveyor.com/discussions/problems/14502-setting-appveyor_repo_tag_name-manually-when-there-is-no-tags-on-pr-builds">https://help.appveyor.com/discussions/problems/14502-setting-appvey...</a></p></div>Dan Halberttag:help.appveyor.com,2012-11-13:Comment/458456342018-08-07T16:11:10Z2018-08-07T16:11:10Zhow can I use parameters from webhook call from GitHub in build?<div><p>Can you point to the build that the log is from?</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/458456342018-08-07T19:11:39Z2018-08-07T19:11:39Zhow can I use parameters from webhook call from GitHub in build?<div><p>Here you go: <a href="https://ci.appveyor.com/project/adafruit-adabot/adafruit-nrf52-nrfutil/build/1.0.6">https://ci.appveyor.com/project/adafruit-adabot/adafruit-nrf52-nrfu...</a></p></div>Dan Halberttag:help.appveyor.com,2012-11-13:Comment/458456342018-08-07T20:12:38Z2018-08-07T20:12:38Zhow can I use parameters from webhook call from GitHub in build?<div><p>Hmmm. I followed the exact procedure and didn't have the same problem. AppVeyor doesn't show the tag that should be read in the build header either.<br>
Can you confirm that your webhook setup is the same as the screenshots (second screenshot is of the "release" webhook).</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/458456342018-08-07T22:29:01Z2018-08-07T22:29:01Zhow can I use parameters from webhook call from GitHub in build?<div><p>My webhook screenshot looks the same as yours, except that I only have a release webhook, not aalso pull request and push one.</p>
<p>The content type is <code>application/x-www-form-urlencoded</code>, not <code>application/json</code>.</p>
<p>There were two webhook requests sent, a few minutes apart. The first is below. The second has the <code>$(APPVEYOR_REPO_TAG_NAME)</code> release, because the new release triggered the second.</p>
<p>Headers and payload from the first one:<br></p>
<pre>
<code>Request URL: https://ci.appveyor.com/api/github/webhook?id=g3fnhu985bwc6osi
Request method: POST
content-type: application/x-www-form-urlencoded
Expect:
User-Agent: GitHub-Hookshot/4f5b68a
X-GitHub-Delivery: 587c3090-99be-11e8-989e-97933de41e77
X-GitHub-Event: release</code>
</pre>
<pre>
<code>{
"action": "published",
"release": {
"url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/releases/12278428",
"assets_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/releases/12278428/assets",
"upload_url": "https://uploads.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/releases/12278428/assets{?name,label}",
"html_url": "https://github.com/adafruit/Adafruit_nRF52_nrfutil/releases/tag/0.5.3.post8",
"id": 12278428,
"node_id": "MDc6UmVsZWFzZTEyMjc4NDI4",
"tag_name": "0.5.3.post8",
"target_commitish": "master",
"name": "appveyor fixes",
"draft": false,
"author": {
"login": "dhalbert",
"id": 2847802,
"node_id": "MDQ6VXNlcjI4NDc4MDI=",
"avatar_url": "https://avatars0.githubusercontent.com/u/2847802?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/dhalbert",
"html_url": "https://github.com/dhalbert",
"followers_url": "https://api.github.com/users/dhalbert/followers",
"following_url": "https://api.github.com/users/dhalbert/following{/other_user}",
"gists_url": "https://api.github.com/users/dhalbert/gists{/gist_id}",
"starred_url": "https://api.github.com/users/dhalbert/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/dhalbert/subscriptions",
"organizations_url": "https://api.github.com/users/dhalbert/orgs",
"repos_url": "https://api.github.com/users/dhalbert/repos",
"events_url": "https://api.github.com/users/dhalbert/events{/privacy}",
"received_events_url": "https://api.github.com/users/dhalbert/received_events",
"type": "User",
"site_admin": false
},
"prerelease": false,
"created_at": "2018-08-06T21:16:08Z",
"published_at": "2018-08-06T21:19:04Z",
"assets": [
],
"tarball_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/tarball/0.5.3.post8",
"zipball_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/zipball/0.5.3.post8",
"body": ""
},
"repository": {
"id": 111049499,
"node_id": "MDEwOlJlcG9zaXRvcnkxMTEwNDk0OTk=",
"name": "Adafruit_nRF52_nrfutil",
"full_name": "adafruit/Adafruit_nRF52_nrfutil",
"owner": {
"login": "adafruit",
"id": 181069,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE4MTA2OQ==",
"avatar_url": "https://avatars3.githubusercontent.com/u/181069?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/adafruit",
"html_url": "https://github.com/adafruit",
"followers_url": "https://api.github.com/users/adafruit/followers",
"following_url": "https://api.github.com/users/adafruit/following{/other_user}",
"gists_url": "https://api.github.com/users/adafruit/gists{/gist_id}",
"starred_url": "https://api.github.com/users/adafruit/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/adafruit/subscriptions",
"organizations_url": "https://api.github.com/users/adafruit/orgs",
"repos_url": "https://api.github.com/users/adafruit/repos",
"events_url": "https://api.github.com/users/adafruit/events{/privacy}",
"received_events_url": "https://api.github.com/users/adafruit/received_events",
"type": "Organization",
"site_admin": false
},
"private": false,
"html_url": "https://github.com/adafruit/Adafruit_nRF52_nrfutil",
"description": "Modified version of Nordic's nrfutil 0.5.x for use with the Adafruit Feather nRF52",
"fork": false,
"url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil",
"forks_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/forks",
"keys_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/teams",
"hooks_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/hooks",
"issue_events_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/issues/events{/number}",
"events_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/events",
"assignees_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/assignees{/user}",
"branches_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/branches{/branch}",
"tags_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/tags",
"blobs_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/statuses/{sha}",
"languages_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/languages",
"stargazers_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/stargazers",
"contributors_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/contributors",
"subscribers_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/subscribers",
"subscription_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/subscription",
"commits_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/contents/{+path}",
"compare_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/merges",
"archive_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/downloads",
"issues_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/issues{/number}",
"pulls_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/pulls{/number}",
"milestones_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/milestones{/number}",
"notifications_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/labels{/name}",
"releases_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/releases{/id}",
"deployments_url": "https://api.github.com/repos/adafruit/Adafruit_nRF52_nrfutil/deployments",
"created_at": "2017-11-17T02:50:43Z",
"updated_at": "2018-08-06T21:16:48Z",
"pushed_at": "2018-08-06T21:16:47Z",
"git_url": "git://github.com/adafruit/Adafruit_nRF52_nrfutil.git",
"ssh_url": "git@github.com:adafruit/Adafruit_nRF52_nrfutil.git",
"clone_url": "https://github.com/adafruit/Adafruit_nRF52_nrfutil.git",
"svn_url": "https://github.com/adafruit/Adafruit_nRF52_nrfutil",
"homepage": "",
"size": 6954,
"stargazers_count": 3,
"watchers_count": 3,
"language": "Python",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 2,
"mirror_url": null,
"archived": false,
"open_issues_count": 1,
"license": {
"key": "bsd-3-clause",
"name": "BSD 3-Clause &quot;New&quot; or &quot;Revised&quot; License",
"spdx_id": "BSD-3-Clause",
"url": "https://api.github.com/licenses/bsd-3-clause",
"node_id": "MDc6TGljZW5zZTU="
},
"forks": 2,
"open_issues": 1,
"watchers": 3,
"default_branch": "master"
},
"organization": {
"login": "adafruit",
"id": 181069,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE4MTA2OQ==",
"url": "https://api.github.com/orgs/adafruit",
"repos_url": "https://api.github.com/orgs/adafruit/repos",
"events_url": "https://api.github.com/orgs/adafruit/events",
"hooks_url": "https://api.github.com/orgs/adafruit/hooks",
"issues_url": "https://api.github.com/orgs/adafruit/issues",
"members_url": "https://api.github.com/orgs/adafruit/members{/member}",
"public_members_url": "https://api.github.com/orgs/adafruit/public_members{/member}",
"avatar_url": "https://avatars3.githubusercontent.com/u/181069?v=4",
"description": null
},
"sender": {
"login": "dhalbert",
"id": 2847802,
"node_id": "MDQ6VXNlcjI4NDc4MDI=",
"avatar_url": "https://avatars0.githubusercontent.com/u/2847802?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/dhalbert",
"html_url": "https://github.com/dhalbert",
"followers_url": "https://api.github.com/users/dhalbert/followers",
"following_url": "https://api.github.com/users/dhalbert/following{/other_user}",
"gists_url": "https://api.github.com/users/dhalbert/gists{/gist_id}",
"starred_url": "https://api.github.com/users/dhalbert/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/dhalbert/subscriptions",
"organizations_url": "https://api.github.com/users/dhalbert/orgs",
"repos_url": "https://api.github.com/users/dhalbert/repos",
"events_url": "https://api.github.com/users/dhalbert/events{/privacy}",
"received_events_url": "https://api.github.com/users/dhalbert/received_events",
"type": "User",
"site_admin": false
}
}</code>
</pre></div>Dan Halberttag:help.appveyor.com,2012-11-13:Comment/458456342018-08-08T06:51:42Z2018-08-08T06:51:42Zhow can I use parameters from webhook call from GitHub in build?<div><p>I see whats happening now. My test was working only because of my "push/pull request" webhook. Since, GitHub needs a tag to associate with a release, the tag creation generates a push event.<br>
When i deactivate the "push/pull request" webhook no build is triggered which makes sense since it turns out that AppVeyor doesn't currently respond to "release" events.</p>
<p>So I'm not sure how your builds are being triggered. Are all your releases created manually through GitHub UI?</p>
<p>We are considering supporting such a scenario but i can't say there is any timeline for such a feature right now.</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/458456342018-08-08T18:58:36Z2018-08-08T18:58:36Zhow can I use parameters from webhook call from GitHub in build?<div><p>Thanks for figuring this out. Yes, we create the releases manually. The idea is to then build some executable versions after we tag and release. We will be using Travis as well to create a PyPi relase of the source code and to build a MacOS executable.</p>
<p>I'll think about doing the build on push rather than on release. Right now we can just run things manually - we don't create new releases all that often.</p>
<p>I think it might be useful to have access to arbitrary values from the webhook payload, sort like how you provide access to environment values now. Then you wouldn't have to create special-purpose values like <code>$(APPVEYOR_REPO_TAG_NAME)</code> in anticipation of certain use cases.</p></div>Dan Halberttag:help.appveyor.com,2012-11-13:Comment/458456342018-08-09T04:56:55Z2018-08-09T04:56:55Zhow can I use parameters from webhook call from GitHub in build?<div><p>Well, i'm guessing that it was more 'in response to' than 'in anticipation of', but I generally agree with your idea.</p>
<p>I'm still unsure how your build was being triggered with only a 'release' webhook. Is it clear to you?</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/458456342018-08-09T12:19:40Z2018-08-09T12:19:40Zhow can I use parameters from webhook call from GitHub in build?<div><p>I tried this again, and it didn't fire, as you noted. I must have triggered them by hand from appveyor.com. That might explain why <code>$(APPVEYOR_REPO_TAG_NAME)</code> wasn't expanded.</p>
<p>Thanks for all your help. This was our first appveyor integration. We'll rethink our workflow based on the current capabilities. Perhaps it's ok to trigger on tag creation, or we can upload the build to elsewhere and just copy it over by hand.</p></div>Dan Halberttag:help.appveyor.com,2012-11-13:Comment/458456342018-08-09T16:47:42Z2018-08-09T16:47:42Zhow can I use parameters from webhook call from GitHub in build?<div><p>No problem.</p>
<p>I'll repost here if there is any development in support for "release events".</p></div>Owen McDonnell