avoid github api rate limits in update workflows

This commit is contained in:
2026-03-09 17:33:45 +00:00
parent 1b63847315
commit 1dfe28047c
3 changed files with 113 additions and 65 deletions
+37 -22
View File
@@ -35,15 +35,10 @@ jobs:
PY
)
latest_version=$(python - <<'PY'
import json, urllib.request
url='https://api.github.com/repos/cjpais/Handy/releases/latest'
with urllib.request.urlopen(url) as r:
data=json.load(r)
tag=data.get('tag_name','').lstrip('v')
print(tag)
PY
)
latest_version=$(curl -fsSLI -o /dev/null -w '%{url_effective}' \
'https://github.com/cjpais/Handy/releases/latest' \
| sed -E 's#.*/##' \
| sed 's/^v//')
echo "current=$current_version"
echo "latest=$latest_version"
@@ -110,16 +105,36 @@ jobs:
fi
echo "Creating PR..."
curl -sS -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
"${api}/pulls" \
-d "$(cat <<JSON
{
\"title\": \"update handy to ${{ steps.update.outputs.version }}\",
\"head\": \"${branch}\",
\"base\": \"main\",
\"body\": \"automated update of handy appimage version and hash\"
}
JSON
)"
created="false"
for head in "${branch}" "thomas:${branch}"; do
echo "Trying head=${head}"
response=$(curl -sS -w '\n%{http_code}' -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
"${api}/pulls" \
-d "$(cat <<JSON
{
"title": "update handy to ${{ steps.update.outputs.version }}",
"head": "${head}",
"base": "main",
"body": "automated update of handy appimage version and hash"
}
JSON
)")
body=$(printf '%s\n' "$response" | sed '$d')
code=$(printf '%s\n' "$response" | tail -n1)
echo "Create PR status: $code"
echo "$body"
if [ "$code" -ge 200 ] && [ "$code" -lt 300 ]; then
created="true"
break
fi
done
if [ "$created" != "true" ]; then
echo "PR creation failed"
exit 1
fi
+38 -22
View File
@@ -36,15 +36,10 @@ jobs:
PY
)
latest_version=$(python - <<'PY'
import json, urllib.request
url='https://api.github.com/repos/imputnet/helium-linux/releases/latest'
with urllib.request.urlopen(url) as r:
data=json.load(r)
tag=data.get('tag_name','').lstrip('v')
print(tag)
PY
)
latest_version=$(curl -fsSLI -o /dev/null -w '%{url_effective}' \
'https://github.com/imputnet/helium-linux/releases/latest' \
| sed -E 's#.*/##' \
| sed 's/^v//')
echo "current=$current_version"
echo "latest=$latest_version"
@@ -110,16 +105,37 @@ jobs:
exit 0
fi
curl -fsS -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
"${api}/pulls" \
-d "$(cat <<JSON
{
\"title\": \"update helium to ${{ steps.update.outputs.version }}\",
\"head\": \"${branch}\",
\"base\": \"main\",
\"body\": \"automated update of helium appimage version and hash\"
}
JSON
)"
echo "Creating PR..."
created="false"
for head in "${branch}" "thomas:${branch}"; do
echo "Trying head=${head}"
response=$(curl -sS -w '\n%{http_code}' -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
"${api}/pulls" \
-d "$(cat <<JSON
{
"title": "update helium to ${{ steps.update.outputs.version }}",
"head": "${head}",
"base": "main",
"body": "automated update of helium appimage version and hash"
}
JSON
)")
body=$(printf '%s\n' "$response" | sed '$d')
code=$(printf '%s\n' "$response" | tail -n1)
echo "Create PR status: $code"
echo "$body"
if [ "$code" -ge 200 ] && [ "$code" -lt 300 ]; then
created="true"
break
fi
done
if [ "$created" != "true" ]; then
echo "PR creation failed"
exit 1
fi
+38 -21
View File
@@ -35,14 +35,10 @@ jobs:
PY
)
latest_version=$(python - <<'PY'
import json, urllib.request
url='https://api.github.com/repos/zen-browser/desktop/releases/latest'
with urllib.request.urlopen(url) as r:
data=json.load(r)
print(data.get('tag_name','').lstrip('v'))
PY
)
latest_version=$(curl -fsSLI -o /dev/null -w '%{url_effective}' \
'https://github.com/zen-browser/desktop/releases/latest' \
| sed -E 's#.*/##' \
| sed 's/^v//')
echo "current=$current_version"
echo "latest=$latest_version"
@@ -107,16 +103,37 @@ jobs:
exit 0
fi
curl -fsS -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
"${api}/pulls" \
-d "$(cat <<JSON
{
\"title\": \"update zen browser to ${{ steps.update.outputs.version }}\",
\"head\": \"${branch}\",
\"base\": \"main\",
\"body\": \"automated update of zen browser appimage version and hash\"
}
JSON
)"
echo "Creating PR..."
created="false"
for head in "${branch}" "thomas:${branch}"; do
echo "Trying head=${head}"
response=$(curl -sS -w '\n%{http_code}' -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
"${api}/pulls" \
-d "$(cat <<JSON
{
"title": "update zen browser to ${{ steps.update.outputs.version }}",
"head": "${head}",
"base": "main",
"body": "automated update of zen browser appimage version and hash"
}
JSON
)")
body=$(printf '%s\n' "$response" | sed '$d')
code=$(printf '%s\n' "$response" | tail -n1)
echo "Create PR status: $code"
echo "$body"
if [ "$code" -ge 200 ] && [ "$code" -lt 300 ]; then
created="true"
break
fi
done
if [ "$created" != "true" ]; then
echo "PR creation failed"
exit 1
fi