Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade deprecated set-* #1917

Merged
merged 1 commit into from
Oct 25, 2022
Merged

Upgrade deprecated set-* #1917

merged 1 commit into from
Oct 25, 2022

Conversation

rez1dent3
Copy link
Contributor

Second try #1910...

@ondrejmirtes Hello. I'm not sure that there will be a correct log (log escaping). Unfortunately, I can't check it in my fork. At least there is no more error: https://github.com/rez1dent3/phpstan-src/actions/runs/3322690041/jobs/5492131881

@rez1dent3 rez1dent3 marked this pull request as draft October 25, 2022 16:55
@rez1dent3
Copy link
Contributor Author

rez1dent3 commented Oct 25, 2022

@ondrejmirtes While translated into draft. Tomorrow I will check another option, maybe it will work better. Done

https://github.com/rez1dent3/phpstan-src/actions/runs/3322894879/jobs/5492570187

@rez1dent3 rez1dent3 marked this pull request as ready for review October 25, 2022 17:17
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@rez1dent3
Copy link
Contributor Author

@ondrejmirtes ondrejmirtes merged commit e6d9df2 into phpstan:1.9.x Oct 25, 2022
@ondrejmirtes
Copy link
Member

Thank you very much!

@ondrejmirtes
Copy link
Member

Hey @rez1dent3 it looks like you know your stuff when it comes to Bash. Could you please help me out a bit?

It's about this line:

git commit --gpg-sign -m "Updated PHPStan to commit ${{ github.event.after }}" -m "${{ steps.git-log.outputs.log }}" --author "Ondrej Mirtes <ondrej@mirtes.cz>"

When the Git log contains a commit that contains message with "", like Revert "abc", the command fails. How can I pass the Git log string correctly to git commit -m ""? Thanks.

The failure is:

  git config --global user.name "Ondrej Mirtes"
  git config --global user.email "ondrej@mirtes.cz"
  git add .
  git commit --gpg-sign -m "Updated PHPStan to commit e16c1df489c7002e9e4609ee4f3490ed70d13814" -m "https://github.com/phpstan/phpstan-src/commit/e16c1df489c7002e9e4609ee4f3490ed70d13814 Revert "Improve expression type resolving of superglobals"" --author "Ondrej Mirtes <ondrej@mirtes.cz>"
  lucky_commit e16c1df
  git push
  shell: /usr/bin/bash -e {0}
error: pathspec 'expression' did not match any file(s) known to git
error: pathspec 'type' did not match any file(s) known to git
error: pathspec 'resolving' did not match any file(s) known to git
error: pathspec 'of' did not match any file(s) known to git
error: pathspec 'superglobals' did not match any file(s) known to git

@rez1dent3
Copy link
Contributor Author

git commit --gpg-sign -m "Updated PHPStan to commit e16c1df489c7002e9e4609ee4f3490ed70d13814" -m "https://github.com/phpstan/phpstan-src/commit/e16c1df489c7002e9e4609ee4f3490ed70d13814 Revert \"Improve expression type resolving of superglobals\"" --author "Ondrej Mirtes <ondrej@mirtes.cz>"

Hello. The line escaping is missing. At least I think so.

@rez1dent3
Copy link
Contributor Author

I'll try to make a fix in my free time.

@ondrejmirtes
Copy link
Member

Surprisingly newlines work correctly if you look at some examples of commits here phpstan/phpstan@7380ed0.

What doesn't work are double quotes. Bash is really mysterious to me here. If I had a variable then git commit -m "$INPUT" works flawlessly with any special characters in the variable. But I don't know how to write it when GitHub Actions simply replace the ${{ }} thing with the text.

@herndlm
Copy link
Contributor

herndlm commented Jan 13, 2023

Isn't it that the unescaped double quotes inside the double quotes end the string / arg leading to the following things being interpreted as new args / commands. Or am I oversimplifying this?

@ondrejmirtes
Copy link
Member

It is but I don't know what to do about it.

@herndlm
Copy link
Contributor

herndlm commented Jan 13, 2023

Ah OK, the dynamic part with github actions replacament, got it. I also wonder if there is a better solution than trying to string replace it or use something like https://unix.stackexchange.com/questions/379181/escape-a-variable-for-use-as-content-of-another-script which would need the string to be assigned to a a variable I suppose. Looking forward to the solution :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants