mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-24 19:38:36 +09:00
✨ Better App checker which updates existing issue
This commit is contained in:
@@ -4,26 +4,28 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *"
|
- cron: "0 0 * * *"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
|
||||||
CREATE_ISSUE:
|
concurrency:
|
||||||
description: "Create GitHub issue"
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
required: false
|
cancel-in-progress: true
|
||||||
type: boolean
|
|
||||||
default: false
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
status_check:
|
status_check:
|
||||||
if: github.repository == 'nikhilbadyal/docker-py-revanced'
|
if: github.repository == 'nikhilbadyal/docker-py-revanced'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: checkout repo content
|
- name: Checkout repository
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
|
|
||||||
- name: Setup python
|
- name: Setup python
|
||||||
uses: actions/setup-python@main
|
uses: actions/setup-python@main
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
cache: 'pip' # Enable caching for pip dependencies
|
cache: 'pip'
|
||||||
|
|
||||||
- name: Install Requirements
|
- name: Install Requirements
|
||||||
run: |
|
run: |
|
||||||
@@ -50,12 +52,69 @@ jobs:
|
|||||||
path: status.md
|
path: status.md
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Create Issue Action
|
- name: Update or Create Revanced Status Issue
|
||||||
if: inputs.CREATE_ISSUE
|
uses: actions/github-script@v7.0.1
|
||||||
uses: nashmaniac/create-issue-action@v1.2
|
|
||||||
with:
|
with:
|
||||||
title: Revanced apps Status
|
script: |
|
||||||
token: ${{secrets.GITHUB_TOKEN}}
|
const issueTitle = 'Revanced apps Status';
|
||||||
assignees: ${{ github.repository_owner }}
|
const statusContent = `${{ steps.status.outputs.changelog }}`;
|
||||||
labels: 💁new-app
|
|
||||||
body: ${{ steps.status.outputs.changelog }}
|
// Search for existing issue with the specific title
|
||||||
|
const issues = await github.rest.issues.listForRepo({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
state: 'open',
|
||||||
|
labels: '💁new-app'
|
||||||
|
});
|
||||||
|
|
||||||
|
const existingIssue = issues.data.find(issue =>
|
||||||
|
issue.title === issueTitle
|
||||||
|
);
|
||||||
|
|
||||||
|
if (existingIssue) {
|
||||||
|
// Update existing issue
|
||||||
|
const updateBody = [
|
||||||
|
statusContent,
|
||||||
|
'',
|
||||||
|
'---',
|
||||||
|
`*Last updated: ${new Date().toISOString().split('T')[0]} by automated workflow*`
|
||||||
|
].join('\n');
|
||||||
|
|
||||||
|
await github.rest.issues.update({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: existingIssue.number,
|
||||||
|
body: updateBody
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add a comment to show the update
|
||||||
|
await github.rest.issues.createComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: existingIssue.number,
|
||||||
|
body: `🔄 **Status Updated** - ${new Date().toISOString().split('T')[0]}\n\nThe Revanced apps status has been refreshed with the latest information.`
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(`Updated existing issue #${existingIssue.number}: ${issueTitle}`);
|
||||||
|
} else {
|
||||||
|
// Create new issue if none exists
|
||||||
|
const createBody = [
|
||||||
|
statusContent,
|
||||||
|
'',
|
||||||
|
'---',
|
||||||
|
`*Created: ${new Date().toISOString().split('T')[0]} by automated workflow*`,
|
||||||
|
'',
|
||||||
|
'This issue will be automatically updated daily with the latest Revanced apps status.'
|
||||||
|
].join('\n');
|
||||||
|
|
||||||
|
const newIssue = await github.rest.issues.create({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
title: issueTitle,
|
||||||
|
body: createBody,
|
||||||
|
assignees: [context.repo.owner],
|
||||||
|
labels: ['💁new-app']
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(`Created new issue #${newIssue.data.number}: ${issueTitle}`);
|
||||||
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ from src.exceptions import (
|
|||||||
APKMonkIconScrapError,
|
APKMonkIconScrapError,
|
||||||
APKPureIconScrapError,
|
APKPureIconScrapError,
|
||||||
BuilderError,
|
BuilderError,
|
||||||
ScrapingError,
|
|
||||||
)
|
)
|
||||||
from src.patches import Patches
|
from src.patches import Patches
|
||||||
from src.utils import apkmirror_status_check, bs4_parser, handle_request_response, request_header, request_timeout
|
from src.utils import apkmirror_status_check, bs4_parser, handle_request_response, request_header, request_timeout
|
||||||
@@ -158,11 +157,12 @@ def icon_scrapper(package_name: str) -> str:
|
|||||||
}
|
}
|
||||||
|
|
||||||
for scraper_name, error_type in scraper_names.items():
|
for scraper_name, error_type in scraper_names.items():
|
||||||
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
return str(globals()[scraper_name](package_name))
|
return str(globals()[scraper_name](package_name))
|
||||||
except error_type:
|
except error_type:
|
||||||
pass
|
pass
|
||||||
except ScrapingError:
|
except Exception: # noqa: BLE001,S110
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return not_found_icon
|
return not_found_icon
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ PLAY_STORE_BASE_URL = "https://play.google.com"
|
|||||||
PLAY_STORE_APK_URL = f"{PLAY_STORE_BASE_URL}/store/apps/details?id=" + "{}"
|
PLAY_STORE_APK_URL = f"{PLAY_STORE_BASE_URL}/store/apps/details?id=" + "{}"
|
||||||
APK_COMBO_BASE_URL = "https://apkcombo.com"
|
APK_COMBO_BASE_URL = "https://apkcombo.com"
|
||||||
APK_COMBO_GENERIC_URL = APK_COMBO_BASE_URL + "/genericApp/{}"
|
APK_COMBO_GENERIC_URL = APK_COMBO_BASE_URL + "/genericApp/{}"
|
||||||
not_found_icon = "https://img.icons8.com/bubbles/500/android-os.png"
|
not_found_icon = "https://www.svgrepo.com/download/441689/page-not-found.svg"
|
||||||
revanced_api = "https://api.revanced.app/v4/patches/list"
|
revanced_api = "https://api.revanced.app/v4/patches/list"
|
||||||
APK_MONK_BASE_URL = "https://www.apkmonk.com"
|
APK_MONK_BASE_URL = "https://www.apkmonk.com"
|
||||||
APKEEP = "apkeep"
|
APKEEP = "apkeep"
|
||||||
|
|||||||
Reference in New Issue
Block a user