您当前可以通过以下方式设置环境变量:
- name: Configure Environment Variables
uses: allenevans/set-env@v1.0.0
with:
CDN_PATH: app-foo/${{ github.run_id }}
CDN_URL: 'https://cdn.mycompany.com'
JIRA_TICKET_ID: ${{ match(github.ref, ...) }} # How can I extract a string from a branch name?
JIRA_TICKET_ID: ${{ match(github.ref, ...) }}
答案 0 :(得分:1)
我不认为github动作中有内置功能可以做到这一点。但是,您可以在采取行动之前先采取步骤,为您获取吉拉票。
注意:您需要将sed正则表达式修改为一个以获取票证。现在,它仅从引用中获取分支名称
- id: getjiraticket
run: echo "::set-output name=jiraticketid::`echo "${{ github.ref }}" | sed 's/.*\///'`"
- name: Configure Environment Variables
uses: allenevans/set-env@v1.0.0
with:
CDN_PATH: app-foo/${{ github.run_id }}
CDN_URL: 'https://cdn.mycompany.com'
JIRA_TICKET_ID: ${{ steps.getjiraticket.outputs.jiraticketid }}