target_url mapping inconsistent with deployment-action
nirvdrum opened this issue · 4 comments
I'm not sure which project is correct, but deployment-status and deployment-action are advertised as working well together. The sample code in both repositories shows setting target_url
as the URL of the deployed application. However, deployment-action maps that URL to environment_url
in the created deployment, whereas deployment-status maps it to target_url
. I suspect deployment-action is correct, because when I create a deployment GitHub shows a "View Deployment" button, but when I update its status, the button goes away.
If I change my usage of deployment-status to update environment_url
instead target_url
, the "View Deployments" button sticks around. But, this also appears to be in conflict with the project's documentation. Unfortunately, the API docs aren't terribly clear on this and indicate that environment_url
is in preview, so I can't really tell which should be used. However, it looks to me like target_url
should map to the same API field in both projects.
Any update - the docs for the action mention both fields - which one should be used?
Had the same problem, and just now took another look at the API docs:
- The documentation of the deployment status states:
- target_url: The target URL to associate with this status. This URL should contain output to keep the user updated while the task is running or serve as historical information for what happened in the deployment. Default: "" Note: It's recommended to use the log_url parameter, which replaces target_url.
- log_url: The full URL of the deployment's output. This parameter replaces target_url. We will continue to accept target_url to support legacy uses, but we recommend replacing target_url with log_url. Setting log_url will automatically set target_url to the same value. Default: ""
Note: This parameter requires you to use the application/vnd.github.ant-man-preview+json custom media type.- environment_url: Sets the URL for accessing your environment. Default: ""
Note: This parameter requires you to use the application/vnd.github.ant-man-preview+json custom media type.
For me this means: The API engineers recognized the confusing naming, and renamed target_url to log_url. Unfortunately, the deployment-action maps the input parameter target_url
to environment_url
for the initial status, as the OP already mentioned.
TL;DR: To get the "View deployment" button
- use
target_url
with the deployment-action, if you want the button to be shown even before the deployment succeeded. - Use
environment_url
with the deployment-status action. This is required, otherwise the deployment-status action will fall back to the empty string, which effectively removes the URL from the environment, and hence the "View deployment" button will not be displayed.
The behavior for getting a View deployment button to appear is quite spotty for me too, is there maybe a different action folks found here that is more up to date?
Thanks all - and my apologies for the delayed reply here. In line with GitHub's recommendation I have removed target_url
and replaced it with environment-url
in v2 of this action.