mirror of
https://github.com/XTLS/Xray-docs-next.git
synced 2026-09-22 22:38:05 +03:00
68 lines
1.8 KiB
YAML
68 lines
1.8 KiB
YAML
name: Cleanup Stale Xray-core Version Badges
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 0 * * *"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
concurrency:
|
|
group: cleanup-version-badges
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
cleanup:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ github.ref_name }}
|
|
token: ${{ secrets.ACTION_PERSONAL_TOKEN }}
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Resolve latest Xray-core release
|
|
id: latest
|
|
uses: actions/github-script@v8
|
|
with:
|
|
github-token: ${{ secrets.ACTION_PERSONAL_TOKEN }}
|
|
script: |
|
|
const release = await github.request(
|
|
"GET /repos/{owner}/{repo}/releases/latest",
|
|
{
|
|
"owner": "XTLS",
|
|
"repo": "Xray-core",
|
|
"headers": {
|
|
"accept": "application/vnd.github+json",
|
|
"X-GitHub-Api-Version": "2026-03-10"
|
|
}
|
|
}
|
|
)
|
|
|
|
core.setOutput("tag", release.data.tag_name)
|
|
core.info(`Latest Xray-core release: ${release.data.tag_name}`)
|
|
|
|
- name: Remove stale version badges
|
|
run: node scripts/cleanup-version-badges.mjs --latest "${{ steps.latest.outputs.tag }}"
|
|
|
|
- name: Commit cleaned docs
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
|
|
if git diff --quiet; then
|
|
echo "No stale version badges to clean."
|
|
exit 0
|
|
fi
|
|
|
|
git add docs
|
|
git commit -m "chore: clear stale Xray-core badges for ${{ steps.latest.outputs.tag }}"
|
|
git push
|