revert
This commit is contained in:
@@ -10,9 +10,6 @@ env:
|
||||
ARTIFACT_PATH: "/data"
|
||||
REPO_LIST_FILE: "/data/valid_repos.txt"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
fetch-template:
|
||||
name: Fetch CI Template and .gitattributes
|
||||
@@ -25,14 +22,14 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Mask Sensitive Token
|
||||
run: echo "::add-mask::${{ secrets.GITHUB_TOKEN }}"
|
||||
run: echo "::add-mask::${{ secrets.TOKEN }}"
|
||||
|
||||
- id: load-template
|
||||
name: Load Template from osc/skins-template
|
||||
run: |
|
||||
set -eo pipefail
|
||||
echo "📥 Fetching template from osc/skins-template@$TEMPLATE_PATH"
|
||||
resp=$(curl -sSL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
resp=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" \
|
||||
"$GITEA_API/repos/osc/skins-template/contents/$TEMPLATE_PATH?ref=main")
|
||||
template_b64=$(echo "$resp" | jq -r .content)
|
||||
echo "✅ Template fetched and encoded"
|
||||
@@ -43,7 +40,7 @@ jobs:
|
||||
run: |
|
||||
set -eo pipefail
|
||||
echo "📥 Fetching .gitattributes from osc/skins-template"
|
||||
resp=$(curl -sSL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
resp=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" \
|
||||
"$GITEA_API/repos/osc/skins-template/contents/.gitattributes?ref=main")
|
||||
gitattributes_b64=$(echo "$resp" | jq -r .content)
|
||||
echo "✅ .gitattributes fetched and encoded"
|
||||
@@ -69,10 +66,10 @@ jobs:
|
||||
page=1
|
||||
total_valid=0
|
||||
user_index=1
|
||||
users_total=$(curl -sSL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$GITEA_API/admin/users" | jq 'length')
|
||||
users_total=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$GITEA_API/admin/users" | jq 'length')
|
||||
|
||||
while :; do
|
||||
users_json=$(curl -sSL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$GITEA_API/admin/users?limit=50&page=$page")
|
||||
users_json=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$GITEA_API/admin/users?limit=50&page=$page")
|
||||
users_count=$(echo "$users_json" | jq 'length')
|
||||
[ "$users_count" -eq 0 ] && break
|
||||
|
||||
@@ -80,13 +77,13 @@ jobs:
|
||||
user=$(echo "$users_json" | jq -r ".[$i].login")
|
||||
echo "[$user_index/$users_total] 👤 Checking user: $user"
|
||||
|
||||
repos_json=$(curl -sSL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$GITEA_API/users/$user/repos")
|
||||
repos_json=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$GITEA_API/users/$user/repos")
|
||||
repo_count=$(echo "$repos_json" | jq 'length')
|
||||
|
||||
for j in $(seq 0 $((repo_count - 1))); do
|
||||
owner=$(echo "$repos_json" | jq -r ".[$j].owner.login")
|
||||
repo=$(echo "$repos_json" | jq -r ".[$j].name")
|
||||
contents=$(curl -sSL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$GITEA_API/repos/$owner/$repo/contents?ref=main")
|
||||
contents=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$GITEA_API/repos/$owner/$repo/contents?ref=main")
|
||||
|
||||
if echo "$contents" | jq -e '.[] | select(.type == "file" and .name == "hardlink-songs-folder.bat")' > /dev/null; then
|
||||
echo "$owner/$repo" >> "$repo_file"
|
||||
@@ -144,7 +141,7 @@ jobs:
|
||||
api="$GITEA_API/repos/$owner/$repo"
|
||||
echo "🔧 Syncing CI and .gitattributes to: $owner/$repo"
|
||||
|
||||
default_branch=$(curl -sSL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$api" | jq -r '.default_branch')
|
||||
default_branch=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$api" | jq -r '.default_branch')
|
||||
|
||||
for file in "$TEMPLATE_PATH" ".gitattributes"; do
|
||||
if [[ "$file" == "$TEMPLATE_PATH" ]]; then
|
||||
@@ -156,7 +153,7 @@ jobs:
|
||||
fi
|
||||
|
||||
url="$api/contents/$file"
|
||||
sha=$(curl -sSL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$url" | jq -r '.sha // empty' || true)
|
||||
sha=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$url" | jq -r '.sha // empty' || true)
|
||||
|
||||
if [[ -z "$sha" ]]; then
|
||||
action="Add"
|
||||
@@ -168,7 +165,7 @@ jobs:
|
||||
'{message: $message, content: $content, sha: $sha, branch: $branch}')
|
||||
fi
|
||||
|
||||
if curl -sSL --fail -X PUT -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/json" \
|
||||
if curl -sSL --fail -X PUT -H "Authorization: token ${{ secrets.TOKEN }}" -H "Content-Type: application/json" \
|
||||
-d "$payload" "$url" >/dev/null; then
|
||||
echo "✅ $action successful for $file in $owner/$repo"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user