0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GitHub Actions v2 で mapping values are not allowed in this context エラー

Last updated at Posted at 2019-09-29

はじめに

jobs.<job_id>.steps.run で環境変数を使おうとしたときに下記の Invalid Workflow File エラーに遭遇したので回避方法について。

yaml: line XX: mapping values are not allowed in this context

エラーになる書き方

steps:
  - run: curl -X POST -H "Authorization: Bearer ${{ secrets.LINE_TOKEN }}" -F "message=test" https://notify-api.line.me/api/notify

エラーにならない書き方

steps:
  - run: 'curl -X POST -H "Authorization: Bearer ${{ secrets.LINE_TOKEN }}" -F "message=test" https://notify-api.line.me/api/notify'
steps:
  - run: |
      curl -X POST -H "Authorization: Bearer ${{ secrets.LINE_TOKEN }}" -F "message=test" https://notify-api.line.me/api/notify

おわりに

YAML は : などの記号を含んでいるときにクオテーションで囲ってあげないといけないようです。
(コメントいただいて修正しました、ありがとうございます。)

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?