merge stable into master (#37286)
This commit is contained in:
1
.github/workflows/publish-testing.yml
vendored
1
.github/workflows/publish-testing.yml
vendored
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: publish-testing
|
group: publish-testing
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|||||||
3
.github/workflows/publish.yml
vendored
3
.github/workflows/publish.yml
vendored
@@ -2,6 +2,7 @@ name: Publish
|
|||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: publish
|
group: publish
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@@ -48,12 +49,14 @@ jobs:
|
|||||||
GITHUB_REPOSITORY: ${{ vars.GITHUB_REPOSITORY }}
|
GITHUB_REPOSITORY: ${{ vars.GITHUB_REPOSITORY }}
|
||||||
|
|
||||||
- name: Publish changelog (Discord)
|
- name: Publish changelog (Discord)
|
||||||
|
continue-on-error: true
|
||||||
run: Tools/actions_changelogs_since_last_run.py
|
run: Tools/actions_changelogs_since_last_run.py
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
DISCORD_WEBHOOK_URL: ${{ secrets.CHANGELOG_DISCORD_WEBHOOK }}
|
DISCORD_WEBHOOK_URL: ${{ secrets.CHANGELOG_DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
- name: Publish changelog (RSS)
|
- name: Publish changelog (RSS)
|
||||||
|
continue-on-error: true
|
||||||
run: Tools/actions_changelog_rss.py
|
run: Tools/actions_changelog_rss.py
|
||||||
env:
|
env:
|
||||||
CHANGELOG_RSS_KEY: ${{ secrets.CHANGELOG_RSS_KEY }}
|
CHANGELOG_RSS_KEY: ${{ secrets.CHANGELOG_RSS_KEY }}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ from typing import Any, Iterable
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
import yaml
|
import yaml
|
||||||
|
import time
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
DEBUG_CHANGELOG_FILE_OLD = Path("Resources/Changelog/Old.yml")
|
DEBUG_CHANGELOG_FILE_OLD = Path("Resources/Changelog/Old.yml")
|
||||||
@@ -148,9 +149,23 @@ def get_discord_body(content: str):
|
|||||||
def send_discord_webhook(lines: list[str]):
|
def send_discord_webhook(lines: list[str]):
|
||||||
content = "".join(lines)
|
content = "".join(lines)
|
||||||
body = get_discord_body(content)
|
body = get_discord_body(content)
|
||||||
|
retry_attempt = 0
|
||||||
|
|
||||||
response = requests.post(DISCORD_WEBHOOK_URL, json=body)
|
try:
|
||||||
response.raise_for_status()
|
response = requests.post(DISCORD_WEBHOOK_URL, json=body, timeout=10)
|
||||||
|
while response.status_code == 429:
|
||||||
|
retry_attempt += 1
|
||||||
|
if retry_attempt > 20:
|
||||||
|
print("Too many retries on a single request despite following retry_after header... giving up")
|
||||||
|
exit(1)
|
||||||
|
retry_after = response.json().get("retry_after", 5)
|
||||||
|
print(f"Rate limited, retrying after {retry_after} seconds")
|
||||||
|
time.sleep(retry_after)
|
||||||
|
response = requests.post(DISCORD_WEBHOOK_URL, json=body, timeout=10)
|
||||||
|
response.raise_for_status()
|
||||||
|
except requests.exceptions.RequestException as e:
|
||||||
|
print(f"Failed to send message: {e}")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
def changelog_entries_to_message_lines(entries: Iterable[ChangelogEntry]) -> list[str]:
|
def changelog_entries_to_message_lines(entries: Iterable[ChangelogEntry]) -> list[str]:
|
||||||
|
|||||||
Reference in New Issue
Block a user