Home > Blockchain >  Sed error No such file or directory on Github Actions
Sed error No such file or directory on Github Actions

Time:11-09

I am using a simple GitHub actions to update a value in a file, then upload that file using a curl command. However, GitHub keeps telling me that the file can't be found.

I have ensure it is there by printing ls and also testing locally. It works locally without n issue (I am using a Mac).

Here is my GitHub Actions file:

name: Deploy Preview
"on": pull_request

env:
  GRAPHQL_SECRET: ${{ secrets.graphql_secret }}
  GRAPHQL_API: ${{ secrets.graphql_api }}

jobs:
  deploy:
    name: Deploy Schema
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Upload Schema
        run: yarn upload-schema

and the yarn upload-schema script looks like:

#!/bin/sh
sed -i "" "s|verification_key|${GRAPHQL_SECRET}|" ./schema.graphql
curl -X POST "${GRAPHQL_API}"/admin/schema --data-binary '@schema.graphql'

Do I need to use a different sed command for the linux system on GitHub Actions?

CodePudding user response:

Turns out I had to use a separate type of sed command. I am not very familiar with sed to not too sure what the differences are.

sed -i "s/verification_key/${GRAPHQL_SECRET}/g" schema.graphql
curl -X POST "${GRAPHQL_API}"/admin/schema --data-binary '@schema.graphql'
  • Related