feat: capture stdout and store as output#287
Conversation
|
One potential issue is that secrets aren't masked in the output variable like they are in the log. I was able to fix it with a filtering step, but it's manual: - uses: mad9000/actions-find-and-replace-string@4
id: filter
with:
source: ${{ steps.ssh.outputs.stdout }}
find: '${{ secrets.value }}'
replace: '***'
replaceAll: true
- run: echo '${{ steps.filter.outputs.value }}' |
|
edit: fixed conflicts |
|
@appleboy |
|
I'd add a variable to enable (or disable) this behavior, as sometimes the outputs could be huge |
|
Good point, it should probably also not capture by default because the output has all command output (without censoring, like the gh step interface has) |
|
I think the script should handle masking secrets by itself , not very good practice to depend on another step for doing it , this can cause security issues if some one forget it |
|
I agree! Is there a way to get secret names at runtime? I was under the impression that github action output is filtered before displaying, but doesn't have any filtering on the server side |
|
@GammaGames or @appleboy is there any update on when this would be merged in? |
|
@mikesalvia I don't know, but I should probably make it optional and disabled by default first. I started working on that a little today but have yet to test it: https://github.com/GammaGames/ssh-action/tree/capture_vars |
|
Okay it's optional now. Idk why it's not showing in the github action, it's working fine on nektos act and gitea: https://github.com/GammaGames/ssh-action/actions/runs/12017938366/job/33504424638 edit: started discussion asking for help - https://github.com/orgs/community/discussions/145592 |
|
I will take it. |
|
@GammaGames Please help to resolve the conflicts. |
|
Fixed, also changed the test to use Why remove the |
|
@GammaGames Thanks.
The script_stop function detects each line of instruction, but it cannot handle line breaks using the backslash (). Therefore, I will write another method to solve this problem. |
|
Thank you @GammaGames and all who assisted! |
- Use envs parameter in ssh-action to capture VM_IP variable - Add separate step to set GITHUB_OUTPUT with modern approach - Based on solution from appleboy/ssh-action#287 - This makes VM IP easily accessible to other workflows and jobs - Proper workflow output mechanism without grepping logs
Possibly fixes #274, #38
If successful, it has the following in
steps.ssh.outputs.stdout:On error it acts like it does now.