英文:
Whenever I make a pull request, the new updates goes directly to EC2 instance
问题
每当我创建拉取请求时,我对我的存储库所做的所有更改都会直接传输到AWS上的EC2服务器,无需批准。
这是我的node.js.yml文件的外观:
# 此工作流程将对节点依赖项进行干净的安装,缓存/还原它们,构建源代码并在不同版本的节点上运行测试
# 有关更多信息,请参见:https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Node.js CI
on:
push:
branches: [ "development" ]
pull_request:
branches: [ "development" ]
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
# - run: fuser -k 4000/tcp & fuser -k 4001/tcp
- run: yarn install
- run: yarn build
- run: pm2 start ecosystem.config.js
我尝试删除以下两行,但未成功:
push:
branches: [ "development" ]
英文:
Whenever I make a pull request. all the changes I made to my repo go to EC2 server on AWS directly without approval
this is how my node.js.yml file looks like
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Node.js CI
on:
push:
branches: [ "development" ]
pull_request:
branches: [ "development" ]
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
# - run: fuser -k 4000/tcp & fuser -k 4001/tcp
- run: yarn install
- run: yarn build
- run: pm2 start ecosystem.config.js
I tried deleting the following 2 lines but it didn't work.
push:
branches: [ "development" ]
答案1
得分: 1
你需要做两件事:
on:
# 首先将目标分支更改为main或uat
# 这将确保仅当推送事件到main或uat分支时才会触发工作流程,而不是dev
push:
branches: ["uat"]
# 其次,移除拉取请求触发器
# 对于这种简单情况,使用推送触发器应该足够了。
# pull_request:
# branches: ["development"]
英文:
You have to do two things:
on:
# First change the target branch to main or uat
# this will make sure that only push events to main or uat branch
# triggers a workflow instead of dev
push:
branches: [ "uat" ]
# Second, remove the pull request trigger
# Using push trigger for this simple case should suffice.
# pull_request:
# branches: [ "development"]
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论