Skip to content

Commit

Permalink
ci: Fix detecting changed files
Browse files Browse the repository at this point in the history
  • Loading branch information
jbruechert committed Feb 16, 2024
1 parent ca6d83e commit 97caf78
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test-import.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Fetch submodules
run: git submodule update --init --checkout --remote
uses: actions/checkout@v4
- name: Fetch branches and submodules
run: git fetch --unshallow && git fetch --all && git submodule update --init --checkout --remote
- name: Build docker images
run: docker build -t transitous . -f ci/container/Containerfile
- name: Verify that new feeds can be downloaded
- name: Verify that new feeds can be downloaded and parsed
run: docker run -v $PWD:/transitous -w /transitous transitous ci/fetch-feeds.py merge-request
12 changes: 10 additions & 2 deletions ci/fetch-feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later

import sys
import os
from pathlib import Path
import subprocess

Expand All @@ -20,9 +21,16 @@
for feed in feed_dir.glob("*.json"):
subprocess.check_call(["./src/fetch.py", str(feed.absolute())])
case "merge-request":
# Silence warnings about different ownerships inside and outside of the
# container on actions
subprocess.check_call(
["git", "config", "--global",
"--add", "safe.directory", os.getcwd()])

# Find all files that were changed in the latest commit
changed_files = subprocess.check_output(
["git", "diff", "--name-only", "-r", "HEAD^1", "HEAD"]) \
.decode().splitlines()
["git", "diff", "--name-only", "origin/main", "HEAD"]) \
.decode().splitlines()

changed_feeds = [f for f in changed_files if
f.startswith("feeds/") and f.endswith(".json")]
Expand Down

0 comments on commit 97caf78

Please sign in to comment.