Skip to content

Commit bc500a4

Browse files
committed
Update update_release_branch.yaml
1 parent 9e48103 commit bc500a4

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

.github/workflows/update_release_branch.yaml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
- cron: "0 18 * * 6"
66

77
env:
8+
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
9+
810
BRANCH_FROGPILOT: FrogPilot
911
BRANCH_PREVIOUS: FrogPilot-Previous
1012
BRANCH_STAGING: FrogPilot-Staging
@@ -20,7 +22,7 @@ jobs:
2022
update_due: ${{ steps.check_update.outputs.update_due }}
2123
scheduled_date: ${{ steps.check_update.outputs.scheduled_date }}
2224
steps:
23-
- name: Download the 'update_date' File
25+
- name: Download the "update_date" File
2426
id: download_update
2527
run: |
2628
curl -fLsS "https://raw.githubusercontent.com/FrogAi/FrogPilot/${{ env.BRANCH_STAGING }}/${{ env.UPDATE_FILE }}" -o update_date || touch update_date_missing
@@ -29,18 +31,14 @@ jobs:
2931
id: check_update
3032
run: |
3133
if [ -f update_date_missing ]; then
32-
echo "No update_date file found in FrogPilot-Staging."
3334
echo "update_due=false" >> "$GITHUB_OUTPUT"
3435
exit 0
3536
fi
3637
3738
SCHEDULED_DATE=$(cat update_date)
3839
CURRENT_DATE=$(TZ="${{ env.TZ }}" date +%F)
39-
echo "Scheduled Date: $SCHEDULED_DATE"
40-
echo "Current Date: $CURRENT_DATE"
4140
4241
if [ "$SCHEDULED_DATE" != "$CURRENT_DATE" ]; then
43-
echo "Update not due."
4442
echo "update_due=false" >> "$GITHUB_OUTPUT"
4543
exit 0
4644
fi
@@ -61,10 +59,17 @@ jobs:
6159
- name: Checkout ${{ env.BRANCH_STAGING }}
6260
uses: actions/checkout@v3
6361
with:
62+
persist-credentials: false
63+
6464
fetch-depth: 0
65+
6566
ref: ${{ env.BRANCH_STAGING }}
6667

67-
- name: Update README Date and Remove (${{ env.UPDATE_FILE }})
68+
- name: Authenticate with GITHUB_TOKEN
69+
run: |
70+
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}
71+
72+
- name: Update README Date and Remove update file
6873
run: |
6974
DAY=$(TZ="${{ env.TZ }}" date +'%d' | sed 's/^0//')
7075
case "$DAY" in
@@ -77,7 +82,6 @@ jobs:
7782
YEAR=$(TZ="${{ env.TZ }}" date +'%Y')
7883
NEW_DATE="**${MONTH} ${DAY}${SUFFIX}, ${YEAR}**"
7984
80-
echo "Updating README date to ${NEW_DATE}"
8185
sed -i "/FrogPilot was last updated on:/ { N; N; s/\(\n\)\n.*$/\1\n${NEW_DATE}/; }" README.md
8286
8387
git add README.md
@@ -102,18 +106,12 @@ jobs:
102106
run: |
103107
git fetch origin ${{ env.BRANCH_PREVIOUS }} ${{ env.BRANCH_FROGPILOT }}
104108
105-
- name: Wait Until Noon ${{ env.TZ }} Before Continuing
109+
- name: Wait Until Noon ${{ env.TZ }}
106110
run: |
107111
NOW=$(TZ="${{ env.TZ }}" date +%s)
108112
TARGET=$(TZ="${{ env.TZ }}" date -d "12:00" +%s)
109113
110-
if [ "$NOW" -lt "$TARGET" ]; then
111-
SLEEP_TIME=$((TARGET - NOW))
112-
echo "Sleeping for $SLEEP_TIME seconds until noon..."
113-
sleep $SLEEP_TIME
114-
else
115-
echo "It is already noon or past noon, proceeding immediately."
116-
fi
114+
[ "$NOW" -lt "$TARGET" ] && sleep $((TARGET - NOW))
117115
118116
- name: Push ${{ env.BRANCH_STAGING }}
119117
run: |

0 commit comments

Comments
 (0)