rename it all

This commit is contained in:
Tanishq Dubey 2025-05-10 12:43:16 -04:00
parent 95df44ca29
commit 9f64a3209a
No known key found for this signature in database
GPG Key ID: CFC1931B84DFC3F9
4 changed files with 146 additions and 111 deletions

View File

@ -1,6 +1,6 @@
on: [push]
name: Datadog Software Composition Analysis
name: DDSCA
jobs:
software-composition-analysis:

View File

@ -1,6 +1,6 @@
on: [push]
name: Datadog Secrets Scanning
name: DDSDS
jobs:
static-analysis:

View File

@ -1,6 +1,6 @@
on: [push]
name: Datadog Static Analysis
name: DDSAST
jobs:
static-analysis:

View File

@ -5,7 +5,7 @@ on:
schedule:
# This expression means "run every 3 minutes". Useful for testing.
# To revert to the original 8-hour schedule, change this to '0 */8 * * *'.
- cron: "0 */8 * * *"
- cron: "*/3 * * * *"
# To trigger manually for testing, you can add workflow_dispatch:
# workflow_dispatch:
@ -22,8 +22,8 @@ jobs:
fetch-depth: 0
# Use a token with write access. This should be stored as a secret in your Gitea repo settings.
# The default GITEA_TOKEN might not have push permissions, so a Personal Access Token is recommended.
# Ensure you have a secret named GITEA_TOKEN in your repository settings.
token: ${{ secrets.GITEA_TOKEN }} # Replace GITEA_TOKEN with the name of your secret
# Ensure you have a secret named GITEA_TOKEN with appropriate permissions (including write:actions or api)
token: ${{ secrets.GLOBAL_KEY }} # Replace GITEA_TOKEN with the name of your secret
- name: Set up Git config
# Configure Git user details globally for the runner
@ -33,7 +33,8 @@ jobs:
git config --global user.email "actions-bot@your-gitea-instance.com" # Replace with a suitable email
echo "git config setup complete"
- name: Create and Push Commits
- name: Create and Push Commits and Trigger Workflows
id: push_commits_and_trigger # Updated ID
env:
# Define your list of authors here. Each author should be on a new line,
# formatted as "Author Name <author@email.com>".
@ -60,14 +61,20 @@ jobs:
DWSAuthor Eight <adwsuthor8@example.com>
DWSAuthor Nine <autdwshor9@example.com>
DWSAuthor Ten <autdwshor10@example.com>
COMMIT_COUNT: 12 # Number of commits to create
SLEEP_SECONDS: 120 # Delay between commits in seconds
TARGET_BRANCH: main # The branch to commit to
COMMIT_COUNT: 2 # Number of commits to create
SLEEP_SECONDS: 150 # Delay between commits in seconds
TARGET_BRANCH: main # The branch to commit to and trigger workflows on
GITEA_BASE_URL: https://git.dws.rip # Replace with your Gitea instance URL
REPO_OWNER: dubey # Replace with your repository owner/organization
REPO_NAME: WebGoat # Replace with your repository name
# Define a space-separated list of workflow names to trigger
WORKFLOW_NAMES: "DDSAST DDSDS DDSCA" # Replace with the actual names of your workflows
run: |
echo "starting Create and Push Commits step"
echo "starting Create and Push Commits and Trigger Workflows step"
echo "AUTHOR_LIST content:"
echo "$AUTHOR_LIST" # Echo the content of the variable for debugging
# Mask sensitive content if AUTHOR_LIST were a secret, but here it's in the workflow file for debugging
# echo "$AUTHOR_LIST" | sed 's/@[^>]*>/@***/g' # Example masking
echo "reading author's list into array"
# Read authors into a Bash array using readarray
@ -80,6 +87,10 @@ jobs:
exit 1
fi
# Read workflow names into a Bash array
IFS=' ' read -r -a workflow_array <<< "$WORKFLOW_NAMES"
echo "Workflows to trigger: ${workflow_array[@]}"
echo "Starting commit creation process..."
echo "Authors available: ${#authors[@]}"
echo "Commits to create: $COMMIT_COUNT"
@ -124,11 +135,35 @@ jobs:
echo "Commit $i pushed successfully."
# --- Trigger the other workflows after each successful push ---
echo "Triggering specified workflows on branch '$TARGET_BRANCH' for commit $i..."
# Loop through the list of workflow names and trigger each one
for workflow_name in "${workflow_array[@]}"; do
echo "Attempting to trigger workflow: $workflow_name"
# Construct the API URL
API_URL="${GITEA_BASE_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/actions/workflows/${workflow_name}/dispatches"
# Use curl to send the API request
# Requires a GITEA_TOKEN with write:actions or api scope
curl -X POST \
-H "Authorization: Bearer ${{ secrets.GLOBAL_KEY }}" \
-H "Content-Type: application/json" \
-d '{"ref": "'"$TARGET_BRANCH"'"}' \
"$API_URL"
echo "Workflow trigger request sent for workflow '$workflow_name' for commit $i."
done
echo "Finished triggering workflows for commit $i."
# --- End Trigger ---
# Wait for the specified delay before the next commit, unless it's the last one
if [ $i -lt $COMMIT_COUNT ]; then
echo "Waiting for $SLEEP_SECONDS seconds..."
sleep $SLEEP_SECONDS
echo "Waiting for $SLEEP_SECONDS seconds before the next commit..."
sleep $SLEVE_SECONDS
fi
done
echo "Finished creating $COMMIT_COUNT commits."
echo "Finished creating $COMMIT_COUNT commits and triggering workflows."