Is it possible to use Authorization: Bearer token encrupted?
I am desperately trying to reset the build number to zero. I am using this script:
$apiUrl = 'https://ci.appveyor.com/api'
$accountName = $env:APPVEYOR_ACCOUNT_NAME
$projectSlug = $env:APPVEYOR_PROJECT_SLUG
$headers = @{
"Authorization" = "Bearer [the token here]"
"Content-type" = "application/json"
"Accept" = "application/json"
}
$build = @{
nextBuildNumber = 0
}
$json = $build | ConvertTo-Json
Invoke-RestMethod -Method Put $apiUrl/projects/$accountName/$projectSlug/settings/build-number -Body $json -Headers $headers
My problem is that I want to make this script part of the yml and that will expose the api token. As far as I'm concerned this is a baddie. Is there a way to work this around?
PS: why is it so hard to reset the build counter? I was quite disappointed to realize that ps: Set-AppveyorBuildVariable -Name 'APPVEYOR_BUILD_NUMBER' -Value '0'
simply doesn't do anything and I have to resort to these gimmicks. :(
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
1 Posted by adamstyl on 28 May, 2022 10:43 AM
Well never mind. I figured this out (with some hints from this discussion forum 😊)
It's as simple as doing
And the key is that you can use the my_api_token in the script without any gimmicks:
If that's ok with you (when my time permits it) I will create a pull request in the documentation to mention that small detail -maybe that will save the next poor soul some time. :)
adamstyl closed this discussion on 28 May, 2022 10:43 AM.