gpt4 book ai didi

github - 通过 github 操作合并不会触发通过分支监听的 CI

转载 作者:行者123 更新时间:2023-12-05 05:40:27 27 4
gpt4 key购买 nike

我有两个 github 操作,一个是 merge-staging-in-to-master,另一个是 CI。merge-staging-in-to-master 是手动触发的。而 CI 是由 push to master 触发的。但是,当我手动触发 merge-staging-in-to-master 时,CI 什么都不做......

我想要的期望是在 merge-staging-in-to-master 完成后调用 CI 操作。下面是我的代码。

合并暂存到 master.yml

# This is a basic workflow to help you get started with Actions

name: merge-staging-to-master

# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allows external webhook trigger
repository_dispatch:
types:
- merge-staging-to-master

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
merge-staging-to-master:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
git fetch origin --unshallow
git checkout -t remotes/origin/master
git pull origin master
git config --global user.name "user"
git config --global user.email "user@mail.com"
git merge staging -m "[AUTO] merge staging back to master"
git push

CI.yml

# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-18.04

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'
- name: Install Dependencies
run: |
sudo apt update
sudo apt install -y libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev librsvg2-dev

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v0'

- name: Build
run: sudo npm install --build-from-source && npx prisma generate dev && npm run build

- name: Deploy
run: npm run deploy

最佳答案

这是 GitHub 操作的内置功能,可防止作业触发更多作业并可能在很短的时间内耗尽您的操作分钟数(同时也会阻止其他人的托管运行器)。

用于身份验证的 GitHub 操作 token 上有一个特殊标志,GitHub 通过该标志知道该 token 来自 Actions 工作流。

如果您知道自己在做什么,则可以使用 PAT 或 Oauth 应用 token 来验证您的 git 推送,这将触发进一步的工作流程。如果您搜索 GitHub 市场,您会发现一些可以检索 OAuth 应用程序 token 的操作。

关于github - 通过 github 操作合并不会触发通过分支监听的 CI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72421030/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com