From 93eecdf79f83e9c9d19671b0e65e14d6287b4da4 Mon Sep 17 00:00:00 2001 From: User123698745 Date: Sun, 30 Jul 2023 23:26:59 +0200 Subject: [PATCH] [core] fix new bridge PRs not generating html preview artifacts (#3583) * [core] replace everything except bridge name to get a valid whitelist.txt * [core] do not use hard code repository name to improve working with forks * [core] trim bridge names from whitelist.txt to reduce chance of failure --- .github/workflows/prhtmlgenerator.yml | 6 +++--- lib/Configuration.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/prhtmlgenerator.yml b/.github/workflows/prhtmlgenerator.yml index cacb6642..ce82aef1 100644 --- a/.github/workflows/prhtmlgenerator.yml +++ b/.github/workflows/prhtmlgenerator.yml @@ -18,11 +18,11 @@ jobs: - name: Check out rss-bridge run: | PR=${{github.event.number}}; - wget -O requirements.txt https://raw.githubusercontent.com/RSS-Bridge/rss-bridge/master/.github/prtester-requirements.txt; - wget https://raw.githubusercontent.com/RSS-Bridge/rss-bridge/master/.github/prtester.py; + wget -O requirements.txt https://raw.githubusercontent.com/$GITHUB_REPOSITORY/${{ github.event.pull_request.base.ref }}/.github/prtester-requirements.txt; + wget https://raw.githubusercontent.com/$GITHUB_REPOSITORY/${{ github.event.pull_request.base.ref }}/.github/prtester.py; wget https://patch-diff.githubusercontent.com/raw/$GITHUB_REPOSITORY/pull/$PR.patch; touch DEBUG; - cat $PR.patch | grep " bridges/.*\.php" | sed "s= bridges/\(.*\)Bridge.php.*=\1=g" | sort | uniq > whitelist.txt + cat $PR.patch | grep "\bbridges/.*Bridge\.php\b" | sed "s=.*\bbridges/\(.*\)Bridge\.php\b.*=\1=g" | sort | uniq > whitelist.txt - name: Start Docker - Current run: | docker run -d -v $GITHUB_WORKSPACE/whitelist.txt:/app/whitelist.txt -v $GITHUB_WORKSPACE/DEBUG:/app/DEBUG -p 3000:80 ghcr.io/rss-bridge/rss-bridge:latest diff --git a/lib/Configuration.php b/lib/Configuration.php index 57a7db7e..f5615009 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -113,7 +113,7 @@ final class Configuration if ($enabledBridges === '*') { self::setConfig('system', 'enabled_bridges', ['*']); } else { - self::setConfig('system', 'enabled_bridges', array_filter(explode("\n", $enabledBridges))); + self::setConfig('system', 'enabled_bridges', array_filter(array_map('trim', explode("\n", $enabledBridges)))); } }