Skip to content

Check for compose manager updates #14533

Check for compose manager updates

Check for compose manager updates #14533

name: Check for compose manager updates
on:
workflow_dispatch:
schedule:
- cron: "*/10 * * * *"
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: bundles # Checkout the 'bundles' branch
- name: Install Python dependencies
run: |
sudo apt-get install jq -y
python -m pip install requests
- name: Get artifact URL
id: get_artifact
run: |
WORKFLOW_RUNS=$(curl -sS -H "Authorization: Bearer ${{ secrets.GIT_TOKEN }}" "https://api.github.com/repos/ReVanced/revanced-manager/actions/workflows/pr-build.yml/runs?event=pull_request&status=success")
if [ -z "$WORKFLOW_RUNS" ]; then
echo "Failed to fetch workflow runs."
exit 1
fi
ARTIFACT_URL=$(echo $WORKFLOW_RUNS | jq -r '.workflow_runs[0].artifacts_url')
if [ -z "$ARTIFACT_URL" ]; then
echo "Failed to fetch artifact URL."
exit 1
fi
ARTIFACTS=$(curl -sS "$ARTIFACT_URL")
if [ -z "$ARTIFACTS" ]; then
echo "Failed to fetch artifacts."
exit 1
fi
RUN_ID=$(echo $WORKFLOW_RUNS | jq -r '.workflow_runs[0].id')
ARTIFACT_ID=$(echo $ARTIFACTS | jq -r '.artifacts[] | select(.name == "revanced-manager") | .id')
if [ -z "$ARTIFACT_ID" ]; then
echo "Failed to fetch artifact ID."
exit 1
fi
ARTIFACT_DOWNLOAD_URL="https://github.com/ReVanced/revanced-manager/actions/runs/${RUN_ID}/artifacts/${ARTIFACT_ID}"
echo "artifact_url=$ARTIFACT_DOWNLOAD_URL" >> $GITHUB_OUTPUT
echo "ARTIFACT_DOWNLOAD_URL: $ARTIFACT_DOWNLOAD_URL"
env:
GITHUB_RUN_ID: ${{ github.run_id }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
- name: Check if README needs update
id: check_readme
run: |
python check_readme.py ${{ steps.get_artifact.outputs.artifact_url }}
env:
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
- name: Update README
if: steps.check_readme.outputs.needs_update == 'true'
run: |
python update_readme.py ${{ steps.get_artifact.outputs.artifact_url }}
env:
GITHUB_RUN_ID: ${{ github.run_id }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}