mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-24 19:38:36 +09:00
113 lines
3.4 KiB
YAML
113 lines
3.4 KiB
YAML
name: Check for new Revanced apps
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 0 * * *"
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
|
|
jobs:
|
|
status_check:
|
|
if: github.repository == 'nikhilbadyal/docker-py-revanced'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@main
|
|
|
|
- name: Setup python
|
|
uses: actions/setup-python@main
|
|
with:
|
|
python-version: '3.x'
|
|
cache: 'pip'
|
|
|
|
- name: Install Requirements
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
|
|
- name: Execute Status Check
|
|
run: |
|
|
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
|
|
output=$(python -m scripts.status_check)
|
|
echo "changelog<<$EOF" >> $GITHUB_OUTPUT
|
|
echo "$output" >> $GITHUB_OUTPUT
|
|
echo "$EOF" >> $GITHUB_OUTPUT
|
|
id: status
|
|
|
|
- name: Update Check
|
|
run: |
|
|
echo "${{ steps.status.outputs.changelog }}"
|
|
|
|
- name: Upload status file
|
|
uses: actions/upload-artifact@main
|
|
with:
|
|
name: issue_body.md
|
|
path: status.md
|
|
if-no-files-found: error
|
|
|
|
- name: Update or Create Revanced Status Issue
|
|
uses: actions/github-script@v7.0.1
|
|
with:
|
|
script: |
|
|
const issueTitle = 'Revanced apps Status';
|
|
const statusContent = `${{ 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
|
|
});
|
|
|
|
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}`);
|
|
}
|