2

I encountered a problem when I passed the repository path from A workflow to B workflow, and the value was not passed correctly in checkout actions.

A workflow

jobs:

  Reuse:
    uses: org/repo/.github/workflows/b_workflow.yml
    with:
      enviroment_name: SANDBOX
      repo_name: $GITHUB_REPOSITORY
    secrets: 
      token: ${{ secrets.SOURCE_REPO_TOKEN }}

B workflow

on:
  workflow_call:
    inputs:
      repo_name:
        type: string
        required: true
        description: "REPO Name"

  build:
    runs-on: ubuntu-latest
    environment:
      name: CRM
    steps:
      - uses: actions/checkout@v3
        with:
          repository: ${{ inputs.repo_name }}
          ref: test
          token: ${{ secrets.token }}
          path: source

Output

Run actions/checkout@v3
  with:
    repository: $GITHUB_REPOSITORY
    ref: test
    token: ***
    path: source
    ssh-strict: true
    persist-credentials: true
    clean: true
    fetch-depth: 1
    lfs: false
    submodules: false
    set-safe-directory: true
Error: Invalid repository '$GITHUB_REPOSITORY'. Expected format {owner}/{repo}.

I checked the documentation of github actions, but I didn't find a syntax problem. How should I pass the correct value to the “repository:”?

0

1 Answer 1

2

I solved the problem myself by modifying A flow to the following and it was fine.

A workflow

jobs:

  Reuse:
    uses: org/repo/.github/workflows/b_workflow.yml
    with:
      enviroment_name: SANDBOX
      repo_name: ${{ github.REPOSITORY }}
    secrets: 
      token: ${{ secrets.SOURCE_REPO_TOKEN }}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.