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

Test WorkflowSpec.match() #112

Merged
merged 1 commit into from
Jun 14, 2021
Merged

Test WorkflowSpec.match() #112

merged 1 commit into from
Jun 14, 2021

Conversation

jwodder
Copy link
Member

@jwodder jwodder commented Jun 14, 2021

No description provided.

@jwodder jwodder added the tests Add or improve existing tests label Jun 14, 2021
@@ -64,7 +63,7 @@ def ghrepo(self) -> Repository:

def get_workflows(self) -> Iterator[Workflow]:
for wf in self.ghrepo.get_workflows():
if self.workflow_spec.match(removeprefix(wf.path, ".github/workflows/")):
if self.workflow_spec.match(wf.path):
Copy link
Member

Choose a reason for hiding this comment

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

what is the motivation for this change/PR? I think I have used/relied already on IIRC documented ability to just specify workflow name without leading to it paths, and test below suggests that it would now require full relative name, or am I mistaken and taking .name above would still be in effect and user would not really need to specify full path?

Copy link
Member Author

@jwodder jwodder Jun 14, 2021

Choose a reason for hiding this comment

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

This just moves the stripping of the .github/workflows/ to match(). This was partially motivated by the fact that, when I originally wrote the code, I accidentally swapped the order of the removeprefix() arguments, and it took a while to debug. Now, the basenaming of the workflow path is covered by the tests. (So, yes, workflow specs in the config file are still matched against the workflow basename rather than the full path.)

Copy link
Member

Choose a reason for hiding this comment

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

great, thank you for the explanation! IMHO it was worth placing into a commit message (and propagate into PR description).

@yarikoptic yarikoptic merged commit 8ddfa84 into master Jun 14, 2021
@yarikoptic yarikoptic deleted the test-wkspec-match branch June 14, 2021 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Add or improve existing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants