add release test
Some checks failed
Scheduled Fake Commits / create_scheduled_commits (push) Failing after 23s
Some checks failed
Scheduled Fake Commits / create_scheduled_commits (push) Failing after 23s
This commit is contained in:
parent
06c0be257f
commit
27ab9f89fa
111
.gitea/workflows/release.yml
Normal file
111
.gitea/workflows/release.yml
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
name: Scheduled Fake Commits
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "*/3 * * * *"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
create_scheduled_commits:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- 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.
|
||||||
|
token: ${{ secrets.COMMIT_TOKEN }} # Replace GITEA_TOKEN with the name of your secret
|
||||||
|
|
||||||
|
- name: Set up Git config
|
||||||
|
# Configure Git user details globally for the runner
|
||||||
|
run: |
|
||||||
|
git config --global user.name "Gitea Actions Bot"
|
||||||
|
git config --global user.email "actions-bot@your-gitea-instance.com" # Replace with a suitable email
|
||||||
|
|
||||||
|
- name: Create and Push Commits
|
||||||
|
env:
|
||||||
|
AUTHOR_LIST: |
|
||||||
|
Author One <author1@example.com>
|
||||||
|
Author Two <author2@example.com>
|
||||||
|
Author Three <author3@example.com>
|
||||||
|
Author Four <author4@example.com>
|
||||||
|
Author Five <author5@example.com>
|
||||||
|
Author Six <author6@example.com>
|
||||||
|
Author Seven <author7@example.com>
|
||||||
|
Author Eight <author8@example.com>
|
||||||
|
Author Nine <author9@example.com>
|
||||||
|
Author Ten <author10@example.com>
|
||||||
|
DWSAuthor One <dwsauthor1@example.com>
|
||||||
|
DWSAuthor Two <dwsauthor2@example.com>
|
||||||
|
DWSAuthor Three <dwsauthor3@example.com>
|
||||||
|
DWSAuthor Four <autdwshor4@example.com>
|
||||||
|
DWSAuthor Five <autdwshor5@example.com>
|
||||||
|
DWSAuthor Six <autdwshor6@example.com>
|
||||||
|
DWSAuthor Seven <adwsuthor7@example.com>
|
||||||
|
DWSAuthor Eight <adwsuthor8@example.com>
|
||||||
|
DWSAuthor Nine <autdwshor9@example.com>
|
||||||
|
DWSAuthor Ten <autdwshor10@example.com>
|
||||||
|
COMMIT_COUNT: 2 # Number of commits to create
|
||||||
|
SLEEP_SECONDS: 15 # Delay between commits in seconds
|
||||||
|
TARGET_BRANCH: main # The branch to commit to
|
||||||
|
|
||||||
|
run: |
|
||||||
|
# Read authors into a Bash array
|
||||||
|
IFS=$'\n' read -r -d '' -a authors <<< "$AUTHOR_LIST"
|
||||||
|
|
||||||
|
# Check if authors list is empty
|
||||||
|
if [ ${#authors[@]} -eq 0 ]; then
|
||||||
|
echo "Error: AUTHOR_LIST is empty. Please configure the secret."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Starting commit creation process..."
|
||||||
|
echo "Authors available: ${#authors[@]}"
|
||||||
|
echo "Commits to create: $COMMIT_COUNT"
|
||||||
|
echo "Delay between commits: $SLEEP_SECONDS seconds"
|
||||||
|
echo "Target branch: $TARGET_BRANCH"
|
||||||
|
|
||||||
|
# Loop to create the specified number of commits
|
||||||
|
for i in $(seq 1 $COMMIT_COUNT); do
|
||||||
|
# Calculate the index for the current author, cycling through the list
|
||||||
|
author_index=$(( (i - 1) % ${#authors[@]} ))
|
||||||
|
current_author="${authors[$author_index]}"
|
||||||
|
|
||||||
|
# Extract name and email from the author string
|
||||||
|
# Assumes format "Name <email>"
|
||||||
|
author_name=$(echo "$current_author" | sed -E 's/^(.*) <.*>$/\1/')
|
||||||
|
author_email=$(echo "$current_author" | sed -E 's/^.* <(.*)>$/\1/')
|
||||||
|
|
||||||
|
echo "--- Creating commit $i of $COMMIT_COUNT by $author_name ---"
|
||||||
|
|
||||||
|
# Configure git user for this specific commit
|
||||||
|
git config user.name "$author_name"
|
||||||
|
git config user.email "$author_email"
|
||||||
|
|
||||||
|
# Create a dummy change: append current timestamp and author to a file
|
||||||
|
# This ensures there's always something to commit
|
||||||
|
echo "$(date): Commit $i by $author_name" >> fake_commit_log.txt
|
||||||
|
|
||||||
|
# Stage the changes
|
||||||
|
git add fake_commit_log.txt
|
||||||
|
|
||||||
|
# Commit the changes
|
||||||
|
git commit -m "Automated commit $i by $author_name"
|
||||||
|
|
||||||
|
# Push the commit to the target branch
|
||||||
|
# Use --set-upstream origin $TARGET_BRANCH on the first push if needed
|
||||||
|
echo "Pushing commit..."
|
||||||
|
git push origin HEAD:$TARGET_BRANCH
|
||||||
|
|
||||||
|
echo "Commit $i pushed successfully."
|
||||||
|
|
||||||
|
# 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
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Finished creating $COMMIT_COUNT commits."
|
Loading…
x
Reference in New Issue
Block a user