Download file on build

Hi, we want to integrate with the localization service. The task is - when any changes are pushed to staging branch and deploy is triggered in the netlify, json file with text should be uploaded to localization service using http post request.
So, I tried to add bash script and run it for staging:
Bash Script:

curl -X POST -H "Content-Type: application/json" -d @src/locales/en.json https://localise.biz/api/import/json?key=API_KEY&locale=en-GB

netlify.toml

[context.staging]
  command = "./netlify-build.sh"

But deploy fails with message:

6:14:38 PM: Executing user command: ./netlify-build.sh
6:14:38 PM: /usr/local/bin/build: line 45: ./netlify-build.sh: Permission denied

Could you please advise the correct way, how can we achieve this goal? Thanks in advance!

Git doesn’t always do a great job with permissions, and trying to run a non-executable shell script won’t work. Try this pattern instead:

chmod a+x ./netlify-build.sh && ./netlify-build.sh

or maybe:

sh ./netlify-build.sh

to be sure :slight_smile: