Skip to content

Use a regex to match feature branch#296

Merged
bprobert97 merged 4 commits intomainfrom
fix-feature-branch-detection
Mar 26, 2026
Merged

Use a regex to match feature branch#296
bprobert97 merged 4 commits intomainfrom
fix-feature-branch-detection

Conversation

@rwb27
Copy link
Collaborator

@rwb27 rwb27 commented Mar 25, 2026

I had some odd issues where the feature branch seemed to contain junk characters at the end.

This PR changes two things:

  1. We now match the branch name more robustly with a regex. That should stop us having junk at the end of the string.
  2. We no longer use an if condition on check-for-ofm-feature-branch, instead it will just return an empty string. There's now an if condition on the test-against-ofm-feature-branch job. That removes the need for the somewhat unsightly toJSON and \r\n.
  3. I use an action, rather than a bash script, to match the regex. This is much nicer, I think - working with multiline variables was pretty cumbersome in bash, and debugging was a pain.
  • I've tested the final commit with OFM Feature Branch: verify-ui-elements in the description
  • I've tested the final commit without that string in the description

@barecheck
Copy link

barecheck bot commented Mar 25, 2026

Barecheck - Code coverage report

Total: 96.34%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

I had some odd issues where the feature branch seemed to contain junk characters at the end.

This changes two things:
1. We now match the branch name more robustly with a regex.
2. We no longer use an `if` condition on `check-for-ofm-feature-branch`, instead it will just return an empty string. There's now an `if` condition on the `test-against-ofm-feature-branch` job.
@rwb27 rwb27 force-pushed the fix-feature-branch-detection branch from 5d60d71 to 9a89c02 Compare March 25, 2026 14:49
Given that we can still merge if the workflow fails, it feels best to remove the `continue-on-error` setting from the jobs
that test against OFM.

This isn't intended to be a change of policy, but it will make failures more visible.
@rwb27 rwb27 force-pushed the fix-feature-branch-detection branch 10 times, most recently from a33bdef to 9943353 Compare March 26, 2026 12:21
This replaces my unpleasant bash script with a much clearer action
@rwb27 rwb27 force-pushed the fix-feature-branch-detection branch from 9943353 to 1c77aeb Compare March 26, 2026 12:26
@rwb27
Copy link
Collaborator Author

rwb27 commented Mar 26, 2026

For the record, I've tested commit 1c77aeb with and without the relevant string in the description.

@rwb27 rwb27 requested a review from bprobert97 March 26, 2026 12:27
Copy link
Contributor

@bprobert97 bprobert97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. The only potential thing I notice with the regex on line 225 of the YAML is that [\w\-] only captures alphanumeric characters, underscores and dashes, so if anyone uses a slash or a dot in their OFM branch name it won't get picked up.

This isn't a problem necessarily, but might be worth documenting in a contributing.md or readme.md to prevent confusion in future. This would need documenting in LabThings and OFM Server

This gives slightly more flexibility in specifying the git ref to test against.
@rwb27 rwb27 force-pushed the fix-feature-branch-detection branch from fc26041 to 8adc4f2 Compare March 26, 2026 14:22
@bprobert97
Copy link
Contributor

Regex has been updated to allow dots and slashes - happy for this to go in

@bprobert97 bprobert97 merged commit 99aa380 into main Mar 26, 2026
14 checks passed
@bprobert97 bprobert97 deleted the fix-feature-branch-detection branch March 26, 2026 16:06
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.

2 participants