add-to-project
add-to-project copied to clipboard
Error `Mapping Token` when using Github workflows reusable
Hi all, I'm trying to create a reusable workflow from GitHub actions using actions/add-to-project
. The problem is that it returns an error when parsing secrets A mapping was not expected Unexpected type 'MappingToken' encountered while reading 'input value'. The 'StringToken' type was expected.
This is my code:
Reusable flow:
name: "Adiciona Issues em Projects GitHub"
on:
workflow_call:
inputs:
project_url:
description: "URL do projetcs github"
required: true
type: string
secrets:
token:
description: "Personal token para leitura/escrita projects github"
required: true
jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@main
with:
project-url: {{ inputs.project_url }}
github-token: ${{ secrets.token }}
Reusable actions call:
name: "Adiciona Issues em Projects GitHub"
on:
issues:
types:
- opened
jobs:
add-issue:
uses: "EzzioMoreira/lab-actions/.github/workflows/add-projects.yaml@master"
with:
project_url: https://github.com/users/EzzioMoreira/projects/2
secrets:
token: ${{ secrets.API_TOKEN_GITHUB }}
I tried using another realize tag but always returned the error The 'StringToken' type was expected
.
I think that my code is correct.
Has anyone else reported any problem?
👋 @EzzioMoreira I was able to reproduce this issue in a test organization + repository. The error seems to indicate that the issue is with this line in the add-projects.yaml
:
jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@main
with:
project-url: {{ inputs.project_url }} # Error: A mapping was not expected Unexpected type 'MappingToken' encountered while reading 'inputs value'. The type 'StringToken' was expected.
github-token: ${{ secrets.token }}
I was able to fix this error by interpolating the input value using ${{
instead of just {{
:
jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@main
with:
project-url: ${{ inputs.project_url }}
github-token: ${{ secrets.token }}
Please try this and let me know if you are still having issues. If there is still an error, it would be helpful to include the full stack trace of the error as well. Thank you!
@EzzioMoreira just wanted to check in and see if this has been resolved, if so, will close this out