Skip to content

Commit

Permalink
fix: fixed code change detection when using modules (#1264)
Browse files Browse the repository at this point in the history
* fix code change checking when using modules

* make repo and path args optional

* add error message

* validate single commit
  • Loading branch information
johanneskoester committed Nov 17, 2021
1 parent 01d6102 commit b571e09
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/conventional-prs.yml
Expand Up @@ -13,4 +13,6 @@ jobs:
steps:
- uses: amannn/action-semantic-pull-request@v3.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
validateSingleCommit: true
16 changes: 9 additions & 7 deletions snakemake/jobs.py
Expand Up @@ -244,13 +244,15 @@ def outputs_older_than_script_or_notebook(self):
return
if self.rule.basedir:
# needed if rule is included from another subdirectory
path = os.path.relpath(os.path.join(self.rule.basedir, path))
assert os.path.exists(path), "cannot find {0}".format(path)
script_mtime = os.lstat(path).st_mtime
for f in self.expanded_output:
if f.exists:
if not f.is_newer(script_mtime):
yield f
path = self.rule.basedir.join(path).get_path_or_uri()
if is_local_file(path):
assert os.path.exists(path), "cannot find {0}".format(path)
script_mtime = os.lstat(path).st_mtime
for f in self.expanded_output:
if f.exists:
if not f.is_newer(script_mtime):
yield f
# TODO also handle remote file case here.

@property
def threads(self):
Expand Down
6 changes: 4 additions & 2 deletions snakemake/sourcecache.py
Expand Up @@ -150,12 +150,14 @@ class HostingProviderFile(SourceFile):

def __init__(
self,
repo: str,
path: str,
repo: str = None,
path: str = None,
tag: str = None,
branch: str = None,
commit: str = None,
):
if repo is None:
raise SourceFileError("repo must be given")
if not self.__class__.valid_repo.match(repo):
raise SourceFileError(
"repo {} is not a valid repo specification (must be given as owner/name)."
Expand Down

0 comments on commit b571e09

Please sign in to comment.