Github Action: Split Long Command into Multiple Lines

Bojian Zheng picture Bojian Zheng · Jan 28, 2020 · Viewed 9.2k times · Source

I have a Github action command that is really long:

name: build

on: [push]

jobs:
    build:
        runs-on: ubuntu-18.04
        steps:
            - uses: actions/checkout@v1
            - name: Install Prerequisites
              run: |
                sudo apt-get update
                sudo apt-get install -y --no-install-recommends "a very very long list of prerequisites"

May I know whether it is possible to split the long command into multiple lines for better readability? I have tried the separator '\' but it does not work. Thanks in advance.

Answer

Mike De Marco picture Mike De Marco · May 27, 2020

I have a multi line command using backslash to separate the lines as follows:

- name: Configure functions
  run: firebase functions:config:set \
    some.key1="${{ secrets.SOME_KEY_1 }}" \
    some.key2="${{ secrets.SOME_KEY_2 }}" \
    ...