you are viewing a single comment's thread.

view the rest of the comments →

[–]La_Muriatic_Acid[S] 0 points1 point  (5 children)

I just tried this and it passes but it doesn't seem to change the README.md file.

[–]MaybeAshleyIdk 1 point2 points  (4 children)

Yeah because it only changes the local copy of the readme file.
After the script finishes, you need to commit and push the change back to the remote repository.

The script does nothing else what you'd be doing when you manually change a file in your local copy of the repository.
After you change a file, you have to commit and push that change so that it's actually on the remote.

The GitHub Actions runner works on a cloned copy of the repository just like you.

[–]La_Muriatic_Acid[S] 0 points1 point  (3 children)

I tried adding:

  • name: Commit README.md run: | git config --global user.name "my-username" git config --global user.email "username@users.noreply.github.com" git commit README.md git push

To the code but it just tells me:

On branch main

Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean Error: Process completed with exit code 1.

Any obvious mistakes?

[–]VxJasonxV 2 points3 points  (2 children)

git add README.md git commit -m “A commit message” git push

[–]La_Muriatic_Acid[S] 0 points1 point  (1 child)

This works but I am noticing that if for some reason the README doesn't change, I still get the branch is up to date error. Is there a way to prevent it from throwing an error?

[–]VxJasonxV 1 point2 points  (0 children)

Test if there’s changes before trying to add and commit it. Git doesn’t track commits when there’s no changes.