我还不熟悉 Github Action Runners。 我从主分支创建了一个名为 test-master 的测试主分支,以及另一个名为 test-feature 的功能分支,也是从主分支中提取而来的。 我的 test-master 分支有一个与 Terraform 相关的工作流程。 但是,在 git checkout 行动中出现错误,请查看以下代码和错误:
name: 'Terraform'
on: [pull_request]
jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@test-master
# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
run: terraform init
# Checks that all Terraform configuration files adhere to a canonical format
- name: Terraform Format
id: fmt
run: terraform fmt --recursive
每当我尝试从test-feature分支合并到test-master分支时,它会运行工作流并生成错误。 错误信息:无法解析操作
actions/checkout@test-master
,找不到版本test-master
。请指导我为什么它不能识别test-master分支。
actions/checkout@master
将运行主分支中的代码,而不是v2
分支中的代码。v2
分支跟踪最新版本 - 您应该使用它。 - Edward Thomsonv2
是actions/checkout
动作的最新版本。它是由 GitHub Actions 团队明确创建的,与ref
标签中存在的分支无关。 - Edward Thomson