Hos*_*lah 1 continuous-integration github-actions
这是我的动作脚本:
name: Build
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: |
whoami
sudo mkdir /first_org
sudo chmod -R 777 /first_org
cd /first_org
git clone https://github.com/first_org/site
sudo rm -rf /first_org/site/.git
sudo mkdir /second_org
sudo chmod -R 777 /second_org
cd /second_org
git clone https://github.com/second_org/site
cp -a /first_org/site/. /second_org/site
cd /second_org/site
sudo apt-get update
sudo apt install nodejs
npm build
Run Code Online (Sandbox Code Playgroud)
这/first_org/site是一个公共回购,但这/second_org/site是一个私人回购。
我不使用action/checkout@v2,因为它不允许我们指定要克隆到的绝对路径。因此我不得不使用纯 shell 命令。
这个动作属于/second_org/site回购协议,因此基于文档,我可以用来GITHUB_TOKEN访问它。但没有一个示例显示如何在简单的git clone命令中使用它。
我如何GITHUB_TOKEN在我的 shell 中使用?
您可以在 shell (bash) 中使用令牌进行克隆:
git clone https://<token>@github.com/<owner>/<repoName>.git
请注意,GITHUB_TOKEN可能没有足够的范围权限来在私有存储库上使用。在这种情况下,您将需要使用 PAT。
以下是我在 bash 中创建克隆存储库的操作示例(作为参考):https://github.com/GuillaumeFalourd/create-other-repo-branch-action/blob/main/action.yml
| 归档时间: |
|
| 查看次数: |
4604 次 |
| 最近记录: |