-
Notifications
You must be signed in to change notification settings - Fork 534
Closed
Description
I'm trying to build a branch name using a part of context.ref via this script, but the JSON encoding is getting in the way:
name: Push docs
on:
push:
branch:
- releases/**
jobs:
load:
runs-on: ubuntu-latest
steps:
- id: get-release-name
name: Get release name with github-script
uses: actions/github-script@0.2.0
with:
github-token: ${{github.token}}
script: return context.ref.replace(/^refs\/heads\/releases\//, '')
- name: Push docs
env:
DOCS_BRANCH: docs/${{steps.get-release-name.outputs.result}}
run: |
printenv | grep DOCS_BRANCHThe output is:
DOCS_BRANCH=docs/"v1"
This can be still usable if you're dropping the value into a shell context that will eat the quotes, but is problematic if you're using it to build parameterized inputs for an action. If you made it so you could optionally set result-encoding: string to override the json default and just cast the result to a string:
steps:
- id: get-branch-name
name: Get branch name with github-script
uses: actions/github-script@0.2.0
with:
github-token: ${{github.token}}
result-encoding: string
script: return context.ref.replace(/^refs\/heads\/releases\//, '')
- name: Push docs
uses: myorg/push-docs@v1
with:
commit-to: docs/${{steps.get-release-name.outputs.result}}Then the outputs.result of the step would be usable in building strings later in the job
mob-sakai, amis92, spacemeowx2 and nicolasrouanneamis92
Metadata
Metadata
Assignees
Labels
No labels