-
Notifications
You must be signed in to change notification settings - Fork 238
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
Add a workflow for nitpicking on trailing spaces and similar issues (to discuss) #892
base: main
Are you sure you want to change the base?
Conversation
5a4f490
to
b2294c9
Compare
8506c49
to
8f8f31e
Compare
50e7a5d
to
6ebeb6e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good! 👍 I have some minor comments:
-
As shown below, I'd really suggest to use the
::error::{message}
template to make error messages consistent and distinct from other debug messages. -
You can avoid the
exit
commands (see my comment below). Would reduce the line count a bit. -
If you really want to keep the exit commands, maybe reduce it like this:
if [ ... ]; then echo "::error::Something bad happens" exit 1 fi echo "All fine"
Hope this helps. 🙂
echo -e "\nThis pull request introduces tabs (→) on the following lines:" | ||
echo -e "\n$tab\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest to use the GitHub formatted error message to make it visually distinct from other messages:
Syntax
::error file={name},line={line},col={col}::{message}
Most of these parameters are optional. So you would probably use something like this:
echo -e "\nThis pull request introduces tabs (→) on the following lines:" | |
echo -e "\n$tab\n" | |
echo "::error::This pull request introduces tabs (→) on the following lines:" | |
echo "::error::$tab" |
You may want to apply it to the other echo
commands as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An exit command isn't really necessary if you use the template from previous item. The Action will stop this step anyway.
If that is true, then using two echos with ::error::
in succession as suggested here won't work, because it'd exit after the first ::error::
message. I am also unsure if ::error::
allows for -e
which is extremely necessary for the second echo
.
Additionally, an exit just blows up the code for my taste.
exit 1;
is 7 characters ... if anything "blows up the code", it's hardly that.^^
You can use the continue-on-error: true. What you need is to "summarize" the result of each steps into an output. Then in a last step you check each one and react accordingly
I should probably do something like that. It could have been less work though if continue-on-error worked better though. :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An exit command isn't really necessary if you use the template from previous item. The Action will stop this step anyway.
If that is true, then using two echos with
::error::
in succession as suggested here won't work, because it'd exit after the first::error::
message. I am also unsure if::error::
allows for-e
which is extremely necessary for the secondecho
.
Right, maybe I misremembered that.
Additionally, an exit just blows up the code for my taste.
exit 1; is 7 characters ... if anything "blows up the code", it's hardly that.^^
It's not only this line, there are other lines. But it's probably a matter of taste, so ignore that. 😉
I should probably do something like that. It could have been less work though if continue-on-error worked better though. :/
Right. It was just an idea. As you wrote, maybe for the future it would be better anyway to move it into a "real" GH Action. But for the time being, you could leave it as is.
Regarding this item:
You can use the jobs:
nitpicks:
steps:
- name: Step 1
id: step1
run: |
# ... $RESULT can be 0 or 1
echo "::set-output name=result::$RESULT"
- name: Step 2
id: step2
run: |
# ... $RESULT can be 0 or 1
echo "::set-output name=result::$RESULT"
# many more steps in between
- name: Collect result from each step
run: |
if [[ $(( ${{ steps.step1.outputs.result }} + ${{ steps.step2.outputs.result }} )) -ge 1 ]]; then
# ... maybe output something useful
exit 1
fi (Haven't tested it yet, but I think it should work.) |
6ebeb6e
to
26831b3
Compare
* This is the hackiest possible implementation, if we agree to do this, it would probably be best to use an own GitHub Action action for it. * I wanted to use "continue-on-error: true" in my steps but while that correctly recognizes all issues, people would not see the evil red X marking the check failed. * Output is not particularly pretty currently. * On longer PRs, the current output may be a bit confusing, because we don't try to give file names/lines that failed. * This only runs on PRs. Running on push would mean running after the damage is already dones. * This will only compare main..my-branch, rather than each commit added to my-branch individually * Checking out the 1.3 GB doc-sle repo for 10 seconds worth of scripts is a bit wasteful. Unfortunately, it would not work easily with any kind of --depth setting. :/ * This workflow fails the line length criteria too.
26831b3
to
e169312
Compare
@tomschr @taroth21 I am wondering what to do with this now.
|
@sknorr Although this Action would be nice, I think it isn't something of uttermost importance. You don't need to finish this. Just leave it open for the time being and we can come back later. We could discuss it for the next SLE writers call. |
The implementation there is ... lacking, even compared to what I have:
I am pretty sure that there is an existing action that is much better than mine, but this is not the one. :) |
PR creator: Description
Adds a GitHub workflow to find when commits add:
Caveats etc.:
PR creator: Which product versions do the changes apply to?
When opening a PR, check all versions of the documentation that your PR applies to.
main
, no backport necessary)PR reviewer only: Have all backports been applied?
The doc team member merging your PR will take care of backporting to older documents.
When opening a PR, do not set the following check box.