mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-23 21:55:11 +02:00
ci: clean all workflow caches to script (#936)
This commit is contained in:
parent
32da5f39bb
commit
21a21b86c0
@ -1,12 +1,13 @@
|
|||||||
# Simple job to clear the cache used by a PR when it is closed/merged.
|
# Simple job to clear the cache used by a workflow. This automatically runs when a PR is closed/merged
|
||||||
|
# to clean up the corresponding PR's cache.
|
||||||
|
|
||||||
name: "clear PR cache"
|
name: "clear workflow cache"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
id:
|
id:
|
||||||
description: "Which id to clear:"
|
description: "Which id to clear. Type 'main'/'master'/'all' to clean all."
|
||||||
required: false
|
required: false
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
2
.github/workflows/nightly.yml
vendored
2
.github/workflows/nightly.yml
vendored
@ -9,7 +9,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
isMock:
|
isMock:
|
||||||
description: "Replace to trigger a non-mock run."
|
description: "Replace with any word other than 'mock' to trigger a non-mock run."
|
||||||
default: "mock"
|
default: "mock"
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
|
@ -33,15 +33,32 @@ def main():
|
|||||||
env = os.environ
|
env = os.environ
|
||||||
|
|
||||||
key = env["GITHUB_TOKEN"]
|
key = env["GITHUB_TOKEN"]
|
||||||
pr_id = int(args[1])
|
if args[1].isnumeric():
|
||||||
ref = "refs/pull/{}/merge".format(pr_id)
|
pr_id = int(args[1])
|
||||||
|
ref = "refs/pull/{}/merge".format(pr_id)
|
||||||
|
|
||||||
print("Clearing any caches generated by PR {}".format(pr_id))
|
print("Clearing any caches generated by PR {}".format(pr_id))
|
||||||
with urlopen(cache_list_request(key)) as response:
|
with urlopen(cache_list_request(key)) as response:
|
||||||
response = json.load(response)
|
response = json.load(response)
|
||||||
caches = response["actions_caches"]
|
caches = response["actions_caches"]
|
||||||
for cache in caches:
|
for cache in caches:
|
||||||
if cache["ref"] == ref:
|
if cache["ref"] == ref:
|
||||||
|
id = cache["id"]
|
||||||
|
try:
|
||||||
|
print("Deleting ID {}...".format(id))
|
||||||
|
urlopen(delete_cache_request(key, id))
|
||||||
|
except HTTPError as e:
|
||||||
|
print("HTTPError with delete, error code {}.".format(e.code))
|
||||||
|
except URLError as _:
|
||||||
|
print("URLError with delete.")
|
||||||
|
else:
|
||||||
|
print("Successfully deleted cache ID {}!".format(id))
|
||||||
|
elif args[1] == "main" or args[1] == "master" or args[1] == "all":
|
||||||
|
print("Clearing all caches.")
|
||||||
|
with urlopen(cache_list_request(key)) as response:
|
||||||
|
response = json.load(response)
|
||||||
|
caches = response["actions_caches"]
|
||||||
|
for cache in caches:
|
||||||
id = cache["id"]
|
id = cache["id"]
|
||||||
try:
|
try:
|
||||||
print("Deleting ID {}...".format(id))
|
print("Deleting ID {}...".format(id))
|
||||||
@ -52,6 +69,8 @@ def main():
|
|||||||
print("URLError with delete.")
|
print("URLError with delete.")
|
||||||
else:
|
else:
|
||||||
print("Successfully deleted cache ID {}!".format(id))
|
print("Successfully deleted cache ID {}!".format(id))
|
||||||
|
else:
|
||||||
|
print(f"Skipping, given argument {args[1]}.")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -158,7 +158,7 @@ fn main() -> Result<()> {
|
|||||||
if let Ok(recv) = receiver.recv_timeout(Duration::from_millis(TICK_RATE_IN_MILLISECONDS)) {
|
if let Ok(recv) = receiver.recv_timeout(Duration::from_millis(TICK_RATE_IN_MILLISECONDS)) {
|
||||||
match recv {
|
match recv {
|
||||||
BottomEvent::Resize => {
|
BottomEvent::Resize => {
|
||||||
try_drawing(&mut terminal, &mut app, &mut painter)?;
|
try_drawing(&mut terminal, &mut app, &mut painter)?; // FIXME: This is bugged with frozen?
|
||||||
}
|
}
|
||||||
BottomEvent::KeyInput(event) => {
|
BottomEvent::KeyInput(event) => {
|
||||||
if handle_key_event_or_break(event, &mut app, &collection_thread_ctrl_sender) {
|
if handle_key_event_or_break(event, &mut app, &collection_thread_ctrl_sender) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user