From 84d833dadcc30302ceed4bb626de48907796d4ad Mon Sep 17 00:00:00 2001 From: Nikhil Badyal Date: Sat, 5 Aug 2023 20:01:48 +0530 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Check=20new=20supported=20apps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-apk.yml | 4 +-- .github/workflows/build-artifact.yml | 8 +++--- .github/workflows/codeql-analysis.yml | 34 ---------------------- .github/workflows/status_check.yml | 41 +++++++++++++++++++++++++++ scripts/__init__.py | 0 scripts/status_check.py | 31 ++++++++++++++++++++ src/patches.py | 5 ++++ 7 files changed, 83 insertions(+), 40 deletions(-) delete mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/status_check.yml create mode 100644 scripts/__init__.py create mode 100644 scripts/status_check.py diff --git a/.github/workflows/build-apk.yml b/.github/workflows/build-apk.yml index 54b47b7..58185fd 100644 --- a/.github/workflows/build-apk.yml +++ b/.github/workflows/build-apk.yml @@ -64,7 +64,7 @@ jobs: steps: - name: Download Already Built APKs - uses: actions/download-artifact@v3 + uses: actions/download-artifact@main with: name: Built-APKs - name: Get Date @@ -80,7 +80,7 @@ jobs: RELEASE_PATTERN: "Build*" - name: Upload Build Artifact - uses: ncipollo/release-action@v1.12.0 + uses: ncipollo/release-action@main with: artifacts: "*-output.apk" token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build-artifact.yml b/.github/workflows/build-artifact.yml index ebdcda2..6bc056d 100644 --- a/.github/workflows/build-artifact.yml +++ b/.github/workflows/build-artifact.yml @@ -38,7 +38,7 @@ jobs: steps: - name: Check out Git repository - uses: actions/checkout@v3.5.3 + uses: actions/checkout@main - name: Update Env for custom build run: | @@ -77,7 +77,7 @@ jobs: - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 + uses: mxschmitt/action-tmate@master if: ${{ github.event_name == 'workflow_dispatch' && inputs.DEBUG_ENABLED }} - name: Build Revanced APKs @@ -85,7 +85,7 @@ jobs: docker-compose up --build - name: Upload Build APKS - uses: actions/upload-artifact@v3.1.2 + uses: actions/upload-artifact@main with: name: Built-APKs path: | @@ -95,7 +95,7 @@ jobs: - name: Commit Update file if: ${{ inputs.COMMIT_CHANGELOG }} - uses: stefanzweifel/git-auto-commit-action@v4 + uses: stefanzweifel/git-auto-commit-action@master with: branch: changelogs skip_checkout: true diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index def52b2..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: CodeQL Analysis - -on: - workflow_dispatch: - -jobs: - analyze: - if: github.repository == 'nikhilbadyal/docker-py-revanced' - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'python' ] - - steps: - - name: Checkout repository - uses: actions/checkout@v3.5.3 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/status_check.yml b/.github/workflows/status_check.yml new file mode 100644 index 0000000..8a9d948 --- /dev/null +++ b/.github/workflows/status_check.yml @@ -0,0 +1,41 @@ +name: Check for new apps + +on: + schedule: + - cron: "0 0 * * *" + workflow_dispatch: + +jobs: + status_check: + if: github.repository == 'nikhilbadyal/docker-py-revanced' + runs-on: ubuntu-latest + steps: + - name: checkout repo content + uses: actions/checkout@main + + - name: setup python + uses: actions/setup-python@main + with: + python-version: '3.10' + + - name: install python packages + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Execute Status Check + run: | + output=$(python -m scripts.status_check) + echo "changelog=$output" >>$GITHUB_OUTPUT + id: status + - name: Update Check + run: echo "${{ steps.status.outputs.changelog }}" + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5.0.2 + with: + token: ${{ secrets.GH_TOKEN }} + branch: revanced-update/status-check + title: Revanced apps + commit-message: revanced-app + body: ${{ steps.status.outputs.changelog }} diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scripts/status_check.py b/scripts/status_check.py new file mode 100644 index 0000000..c8c8fb8 --- /dev/null +++ b/scripts/status_check.py @@ -0,0 +1,31 @@ +"""Status check.""" + +import requests + +from src.patches import Patches +from src.utils import handle_response + + +def main() -> None: + repo_url = "https://api.revanced.app/v2/patches/latest" + response = requests.get(repo_url) + handle_response(response) + + parsed_data = response.json() + compatible_packages = parsed_data["patches"] + + possible_apps = set() + for package in compatible_packages: + for compatible_package in package["compatiblePackages"]: + possible_apps.add(compatible_package["name"]) + + supported_app = set(Patches.support_app().keys()) + missing_support = possible_apps.difference(supported_app) + output = "New app found which aren't supported yet.
" + for index, app in enumerate(missing_support): + output += f"{index+1}. [{app}](https://play.google.com/store/apps/details?id={app})
" + print(output) + + +if __name__ == "__main__": + main() diff --git a/src/patches.py b/src/patches.py index 073996e..e168b81 100644 --- a/src/patches.py +++ b/src/patches.py @@ -64,6 +64,11 @@ class Patches(object): key: (value, "_" + value) for key, value in _revanced_extended_app_ids.items() } + @staticmethod + def support_app() -> Dict[str, str]: + """Return supported apps.""" + return Patches._revanced_app_ids + @staticmethod def check_java(dry_run: bool) -> None: """Check if Java17 is installed."""