Skip to content

Add correct commands for steps on Creating a Docker container action page #9432

Closed
@avinal

Description

@avinal

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action

What part(s) of the article would you like to see updated?

The Parts that need modification

Context

Seven months ago I worked on an issue #974 and submitted PR #1256 and #2988. There was performance concern over making shell files executable explicitly inside the Docker. This
#1256 (comment) has all the discussion.

Ultimately it was decided to suggest the users to run chmod +x entrypoint.sh on their machine before pushing it to the remote. I was not convinced that this will work and there won't be any permission issue while running the script inside GitHub Actions and I am still not convinced.

Root of the problem.

For the most part, the above method works fine. The problem occurs only when someone clones the repo and then make changes. The permission is reset and it no longer can be run inside GitHub Actions. And that is why you will see a lot of developers/organizations have explicitly made the shell executable inside GitHub Actions before running it.

What do I suggest

Git provides a way to explicitly change the permission mode of a file so that it doesn't get reset every time there is a clone/fork. The command works as below.

 git update-index --chmod=+x entrypoint.sh

This will change the permission mode of the file in the git index and it can be checked by running following command.

git ls-files --stage entrypoint.sh
# output
100755 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       entrypoint.sh

Here 755 denotes the executable permission.

Additional information

These lines here https://github.com/github/docs/blame/main/content/actions/creating-actions/creating-a-docker-container-action.md#L124-L128 have no use and can be removed if we opt for the above solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionsThis issue or pull request should be reviewed by the docs actions teamcontentThis issue or pull request belongs to the Docs Content teamgood first issueGood for newcomershelp wantedAnyone is welcome to open a pull request to fix this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions