From e4cb8686231cbf50498142738cf0dd161ba8813a Mon Sep 17 00:00:00 2001 From: Tanishq Dubey Date: Sat, 10 May 2025 08:24:45 -0400 Subject: [PATCH] more test --- .gitea/workflows/release.yml | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 220f5cdb1..87c3f310d 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -1,9 +1,15 @@ name: Scheduled Fake Commits on: + # Trigger the workflow on a schedule. 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: "*/3 * * * *" + # To trigger manually for testing, you can add workflow_dispatch: + # workflow_dispatch: + jobs: create_scheduled_commits: runs-on: ubuntu-latest @@ -12,7 +18,12 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 with: + # Fetch the full history to ensure pushes work correctly 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 - name: Set up Git config # Configure Git user details globally for the runner @@ -20,9 +31,14 @@ jobs: echo "setting up git config" git config --global user.name "Gitea Actions Bot" 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 env: + # Define your list of authors here. Each author should be on a new line, + # formatted as "Author Name ". + # For production, this should ideally be stored as a secret named FAKE_COMMIT_AUTHORS. + # For debugging, you can define it directly here as you have done. AUTHOR_LIST: | Author One Author Two @@ -49,13 +65,18 @@ jobs: TARGET_BRANCH: main # The branch to commit to run: | - echo "reading author's list" - # Read authors into a Bash array - IFS=$'\n' read -r -d '' -a authors <<< "$AUTHOR_LIST" + echo "starting Create and Push Commits step" + echo "AUTHOR_LIST content:" + echo "$AUTHOR_LIST" # Echo the content of the variable for debugging + + echo "reading author's list into array" + # Read authors into a Bash array using readarray + readarray -t authors <<< "$AUTHOR_LIST" + echo "finished reading author's list into array" # Check if authors list is empty if [ ${#authors[@]} -eq 0 ]; then - echo "Error: AUTHOR_LIST is empty. Please configure the secret." + echo "Error: AUTHOR_LIST is empty or could not be parsed into an array." exit 1 fi @@ -71,11 +92,15 @@ jobs: author_index=$(( (i - 1) % ${#authors[@]} )) current_author="${authors[$author_index]}" + echo "Processing author: $current_author" # Debug echo + # Extract name and email from the author string # Assumes format "Name " author_name=$(echo "$current_author" | sed -E 's/^(.*) <.*>$/\1/') author_email=$(echo "$current_author" | sed -E 's/^.* <(.*)>$/\1/') + echo "Extracted name: $author_name, email: $author_email" # Debug echo + echo "--- Creating commit $i of $COMMIT_COUNT by $author_name ---" # Configure git user for this specific commit