-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
15ae2c1
commit 060abbb
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Set Logs | ||
|
||
on: | ||
schedule: | ||
- cron: "0 12 1 * *" | ||
|
||
jobs: | ||
time-logs: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: checkout_repo | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: "master" | ||
- name: set-logs | ||
run: bash ./code/bash/step_logs.sh | ||
env: | ||
USER_EMAIL: ${{ secrets.USER_EMAIL}} | ||
USER_NAME: ${{ secrets.USER_NAME}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
BRANCH="master" | ||
|
||
#This was writen based on a course on LinkedIn learning with some minor adjustments. | ||
|
||
# Save the current time into a log file | ||
echo "Current Date:" >> ./code/bash/log.txt && date '+%Y-%m-%d' >> ./code/bash/log.txt | ||
echo "Current Time:" >> ./code/bash/log.txt && date '+%r' >> ./code/bash/log.txt | ||
echo "Epoch Time:" >> ./code/bash/log.txt && date '+%s' >> ./code/bash/log.txt | ||
echo " " >> ./code/bash/log.txt | ||
|
||
# Commit | ||
p=$(pwd) | ||
git config --global --add safe.directory $p | ||
|
||
if [[ "$(git status --porcelain)" != "" ]]; then | ||
git config --global user.name $USER_NAME | ||
git config --global user.email $USER_EMAIL | ||
git add code/bash/log.txt | ||
git commit -m "Update the log" | ||
git push origin $BRANCH | ||
else | ||
echo "Nothing to commit..." | ||
fi |