Help please: Hello-github-actions

I am doing the hello-github-actions course and for whatever reason there is an error preventing the workflow from triggering.

Please help.


Still stuck here, can someone please help?

Your workflow does get triggered, the problem is that running the action fails.

The reason for that is that your entrypoint.sh script uses Windows line endings (CRLF), which confuses the shell (/bin/sh). You need to use Unix line endings (LF). How to fix that depends on the editor you are using.

I am not sure what that means, I used the entrypoint.sh the course module told me to use.

The text of the file looks exactly the same, yes. The problem is with the part you don’t see. At the end of each line are special, usually invisible, characters that say “this line ends here” (that’s called a “line ending”). For example, if you have the following text:

Hello
World

There is a line ending after “Hello”. The problem is that different platforms use different characters for that line ending:

  • Line Feed (LF) on Linux and other Unix-like systems, including current Macs
  • Carriage Return (CR) on old Macs
  • Carriage Return followed by Line Feed (CRLF) on DOS and Windows

The names for those characters come from the typewriter days, check Wikipedia if you’re interested in the history.

Your entrypoint.sh uses Windows-style CRLF line endings, but the Linux shell that’s running in the Docker container for your Action strictly requires LF line endings. You need to open the file in a text editor, set that editor to save with LF (might be called “Unix”) line endings, and save. After that git should show all lines as changed, with no change in visible text. Commit, and hopefully it’ll work. :slightly_smiling_face:

I really appreciate the help. Thank you for the explanation, that makes a lot more sense now.

There is an invisible mismatch in the line endings of my entrypoint.sh that make it incompatible with the dockerfile.
I am using gitkraken, after some digging around I found the setting to use LF line endings. I tried various ways edit both in gitkracken and on github to change to LF endings, but it not seem to be working.

I even tried deleting the whole file and redoing it after making sure LF endings was selected. No luck, I am not sure what is going on.

Is there anything else I can try?

I checked the new file in your repository. The content is correct, there’s just a typo in the file name: It’s called entrypoit.sh instead of entrypoint.sh, so the Docker build fails because it can’t find entrypoint.sh. If you rename the file it should work.

Though, for style I’d recommend removing the spaces at the end of the sh -c "echo [...]" line, and add a line break at the end of the file. But that’s just style, the script itself works.

Lol After all that, I get hung up by a typo.
Corrected the other style things you mentioned, thank you for the tips.
Much appreciated.

1 Like

For future reference how do you check the line endings to tell what kind you have?

Exactly how to do it depends on the editor you’re using. Things that editors commonly offer for this are:

  • A setting to show non-printing characters.
  • An option to select the kind of line endings to use when saving.
  • A GUI element that shows the type of line endings currently used by the document.