how can I use parameters from webhook call from GitHub in build?
I have the following scenario:
When I manually create a release in my repo in GitHub, I want to start an appveyor build which will add a single asset to that newly created release.
My appveyor.yml includes:
artifacts:
- path: 'foo\bar\something.exe'
deploy:
provider: GitHub
force_update: true
auth_token:
secure: xxx
I copied the webhook URL from https://ci.appveyor.com/project/myname/my-projectl/settings. It looks like https://ci.appveyor.com/api/github/webhook?id=blahblah. I entered this URL as a new webhook in https://github.com/myname/my-project/settings/hooks, and set it to trigger on the "Releases Release published in a repository." GitHub event.
When I create a release, the incoming webhook does trigger. The build happens, but then appveyor creates a new release with a tag corresponding to the appveyor build number (1.0.n). Instead, I want it to use the tag_name that is passed in the payload provided with the incoming webhook:
{
"action": "published",
"release": {
"url": "https://api.github.com/repos/nyname/my-project/releases/12345",
...
"tag_name": "4.6.2",
...
How can I get that release.tag_name value into the deploy settings in appveyor.yml? Is it in the environment or available in some other way?
All the webhooks documentation I can find is about outgoing webhooks, not the incoming https://ci.appveyor.com/api/github/webhook?=xxx kind of webhook. I might be looking in the wrong place. Thanks!
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac

Support Staff 1 Posted by Owen McDonnell on 06 Aug, 2018 04:37 AM
Check out the NOTE: section in this part of the docs. I think it describes pretty precisely your scenario.
Basically, you can have a
tag: $(APPVEYOR_REPO_TAG_NAME)entry in your deployment settings.2 Posted by Dan Halbert on 06 Aug, 2018 09:32 PM
Thanks, that looked promising, so I added a
Unfortunately, thetag:value, per$reference did not get expanded, and I ended up with a new release with literally the name$(APPVEYOR_REPO_TAG_NAME). From the appveyor log:(I've since deleted that oddly-named release.)
Full appveyor.yml is here: https://github.com/adafruit/Adafruit_nRF52_nrfutil/blob/master/appv.... I think it should work, but ...
EDIT: Similar issue here: https://help.appveyor.com/discussions/problems/14502-setting-appvey...
Support Staff 3 Posted by Owen McDonnell on 07 Aug, 2018 04:11 PM
Can you point to the build that the log is from?
4 Posted by Dan Halbert on 07 Aug, 2018 07:11 PM
Here you go: https://ci.appveyor.com/project/adafruit-adabot/adafruit-nrf52-nrfu...
Support Staff 5 Posted by Owen McDonnell on 07 Aug, 2018 08:12 PM
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.
Can you confirm that your webhook setup is the same as the screenshots (second screenshot is of the "release" webhook).
6 Posted by Dan Halbert on 07 Aug, 2018 10:29 PM
My webhook screenshot looks the same as yours, except that I only have a release webhook, not aalso pull request and push one.
The content type is
application/x-www-form-urlencoded, notapplication/json.There were two webhook requests sent, a few minutes apart. The first is below. The second has the
$(APPVEYOR_REPO_TAG_NAME)release, because the new release triggered the second.Headers and payload from the first one:
Support Staff 7 Posted by Owen McDonnell on 08 Aug, 2018 06:51 AM
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.
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.
So I'm not sure how your builds are being triggered. Are all your releases created manually through GitHub UI?
We are considering supporting such a scenario but i can't say there is any timeline for such a feature right now.
8 Posted by Dan Halbert on 08 Aug, 2018 06:58 PM
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.
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.
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
$(APPVEYOR_REPO_TAG_NAME)in anticipation of certain use cases.Support Staff 9 Posted by Owen McDonnell on 09 Aug, 2018 04:56 AM
Well, i'm guessing that it was more 'in response to' than 'in anticipation of', but I generally agree with your idea.
I'm still unsure how your build was being triggered with only a 'release' webhook. Is it clear to you?
10 Posted by Dan Halbert on 09 Aug, 2018 12:19 PM
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
$(APPVEYOR_REPO_TAG_NAME)wasn't expanded.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.
Support Staff 11 Posted by Owen McDonnell on 09 Aug, 2018 04:47 PM
No problem.
I'll repost here if there is any development in support for "release events".
Ilya Finkelshteyn closed this discussion on 09 Oct, 2018 09:00 PM.