我创建了一个.yml-github工作流,当我创建一个拉请求时,它必须执行,但我不知道为什么它不执行。
我想做的是:
-
获取分支名称
-
以分支名称的最后一部分为例
test
从…起
feature/hosting/test
将其分配到firebase中的部署通道
-
部署安装之后
jq
-
获取部署中生成的托管utl
-
使用url,在pull请求中添加带有url信息的注释
这是我的。yml
name: Firebase Test Deploy
on:
pull_request:
branches:
- bugfix/hosting/*
- feature/hosting/*
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install Firebase CLI
run: npm install -g firebase-tools
- name: Get branch name
id: get_branch_name
run: echo "::set-output name=branch::$(echo $GITHUB_REF | cut -d/ -f2-)"
- name: Deploy to Firebase
run: |
cd functions && firebase use --token $FIREBASE_TOKEN
firebase hosting:channel:deploy ${{ steps.get_branch_name.outputs.branch }} --only hosting
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
- name: Install jq
run: sudo apt-get update -y && sudo apt-get install -y jq
- name: Get Hosting URL
id: get_hosting_url
run: |
hosting_url=$(firebase hosting:channel:list --json | jq -r '.[0].url')
echo "::set-output name=hosting_url::$hosting_url"
shell: bash
- name: Comment on Pull Request
uses: actions/github-script@0.12.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { context, github } = require('@actions/github');
const comment = `
**Firebase Hosting URL:**
${steps.get_hosting_url.outputs.hosting_url}
`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment,
})
yml文件的路径是
.github/workflows
。
错误在哪里?