canonical / vanilla-framework

From community websites to web applications, this CSS framework will help you achieve a consistent look and feel.
https://vanillaframework.io
GNU Lesser General Public License v3.0
798 stars 163 forks source link

fix Percy workflows not running correctly in multi-label case #5188

Closed jmuzina closed 1 week ago

jmuzina commented 1 week ago

Done

Fixes Percy tests not being run properly against PRs with multiple labels.

The array of label names was being converted to "Array" and my if checks were failing. I quoted the conditionals on the jobs, converted them to JSON, and also removed the dependence on a repo variable for the label name.

QA

Check if PR is ready for release

If this PR contains Vanilla SCSS code changes, it should contain the following changes to make sure it's ready for the release:

webteam-app commented 1 week ago

Demo

Jenkins

demos.haus

bartaz commented 1 week ago

Not sure if I understand what was wrong, and why changing array to JSON fixes it, but if that works I'm good.

jmuzina commented 1 week ago

Not sure if I understand what was wrong, and why changing array to JSON fixes it, but if that works I'm good.

@bartaz

It's not entirely clear to me either - from what I was seeing, this was working in initial tests of the PR, then stopped working when multiple labels were applied to real PRs. I whipped this up as a quick / heavy-handed fix so that our live PRs can get Percy tested, but it can get a more thorough re-look later if needed.

My current best guess is it's something to do with how the array of names is serialized with respect to contains(), or maybe it's just that I quoted the label name with this PR and it wasn't quoted when using the variable. However contains() is supposed to work with arrays out of the box.

So this is converting the array of names into a string, and performing a substring match to find the quoted Percy label.

bartaz commented 1 week ago

Changing label from Bug to Maintenance, as it's not a bug in Vanilla codebase (so doesn't need to be featured as a bugfix for consumers of Vanilla).