Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: remove unneeded / untested workflows #487

Merged
merged 10 commits into from
Aug 7, 2024
63 changes: 63 additions & 0 deletions .github/workflows/delete_workflow_runs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

set -e

if [ $# -eq 0 ]; then
echo "Error: No workflow name provided."
echo "Usage: $0 <workflow-name>"
exit 1
fi

WORKFLOW_NAME="$1"

echo "Fetching repository information..."
REPO_INFO=$(gh repo view --json nameWithOwner)
REPO=$(echo $REPO_INFO | jq -r .nameWithOwner)
echo "Repository: $REPO"

echo "Searching for workflows with name: '$WORKFLOW_NAME'"
WORKFLOW_IDS=$(gh api "/repos/$REPO/actions/workflows" | jq -r ".workflows[] | select(.name == \"$WORKFLOW_NAME\") | .id")

if [ -z "$WORKFLOW_IDS" ]; then
echo "No workflows found with name '$WORKFLOW_NAME'"
exit 1
fi

echo "Found workflow(s) with ID(s): $WORKFLOW_IDS"

delete_runs() {
local workflow_id=$1
local page=$2
echo "Fetching runs for workflow $workflow_id (page $page)..."
RUNS=$(gh api "/repos/$REPO/actions/workflows/$workflow_id/runs?per_page=100&page=$page")
RUN_COUNT=$(echo $RUNS | jq '.workflow_runs | length')

if [ "$RUN_COUNT" -eq 0 ]; then
return 1
fi

echo "Deleting $RUN_COUNT runs..."
echo $RUNS | jq -r '.workflow_runs[].id' | while read -r run_id; do
echo "Deleting run $run_id"
gh api -X DELETE "/repos/$REPO/actions/runs/$run_id"
done

return 0
}

for WORKFLOW_ID in $WORKFLOW_IDS; do
echo "Processing workflow ID: $WORKFLOW_ID"
page=1
while delete_runs $WORKFLOW_ID $page; do
((page++))
done

echo "All runs deleted for workflow ID $WORKFLOW_ID"

echo "Deleting the workflow itself..."
gh api -X DELETE "/repos/$REPO/actions/workflows/$WORKFLOW_ID"

echo "Workflow with ID $WORKFLOW_ID has been deleted."
done

echo "All workflows named '$WORKFLOW_NAME' and their runs have been deleted."
2 changes: 1 addition & 1 deletion .github/workflows/deploy_gcp_bootnodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: google-github-actions/auth@v2
with:
workload_identity_provider: projects/784882329213/locations/global/workloadIdentityPools/github-oidc-pool/providers/github-oidc-provider
service_account: gh-masa-oracle-${{ github.ref_name }}@masa-chain.iam.gserviceaccount.com
service_account: gh-masa-oracle-test@masa-chain.iam.gserviceaccount.com
- name: Install Google Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
Expand Down
54 changes: 0 additions & 54 deletions .github/workflows/gh-release.yaml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/publish-to-docs.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Go
name: Run Go Tests

on:
push:
Expand All @@ -24,4 +24,4 @@ jobs:
run: go mod tidy

- name: Run tests
run: go test ./...
run: go test ./...
Loading