Skip to content

Commit

Permalink
Update scheduled-advanced.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
katydecorah committed Jun 18, 2024
1 parent 5f1562c commit cb27074
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions .github/workflows/scheduled-advanced.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,40 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setpost title and date
- name: Set post title and dates
run: |
MONTH=$(date +%m)
YEAR=$(date +%Y)
declare -A SEASONS=(
["03"]="Winter"
["06"]="Spring"
["09"]="Summer"
["12"]="Fall"
)
set_env_vars() {
local season=$1
local start_date=$2
local end_date=$3
echo "POST_TITLE=${YEAR} ${season}" >> $GITHUB_ENV
echo "START_DATE=${start_date}" >> $GITHUB_ENV
echo "END_DATE=${end_date}" >> $GITHUB_ENV
}
case $MONTH in
03)
echo "POST_TITLE=$(($YEAR - 1))/${YEAR} Winter" >> $GITHUB_ENV
echo "START_DATE=$(($YEAR - 1))-12-21" >> $GITHUB_ENV
echo "END_DATE=${YEAR}-03-20" >> $GITHUB_ENV
"03")
set_env_vars ${SEASONS[$MONTH]} "$(($YEAR - 1))-12-21" "${YEAR}-03-20"
;;
06)
echo "POST_TITLE=${YEAR} Spring" >> $GITHUB_ENV
echo "START_DATE=${YEAR}-03-21" >> $GITHUB_ENV
echo "END_DATE=${YEAR}-06-20" >> $GITHUB_ENV
"06")
set_env_vars ${SEASONS[$MONTH]} "${YEAR}-03-21" "${YEAR}-06-20"
;;
09)
echo "POST_TITLE=${YEAR} Summer" >> $GITHUB_ENV
echo "START_DATE=${YEAR}-06-21" >> $GITHUB_ENV
echo "END_DATE=${YEAR}-09-20" >> $GITHUB_ENV
"09")
set_env_vars ${SEASONS[$MONTH]} "${YEAR}-06-21" "${YEAR}-09-20"
;;
12)
echo "POST_TITLE=${YEAR} Fall" >> $GITHUB_ENV
echo "START_DATE=${YEAR}-09-21" >> $GITHUB_ENV
echo "END_DATE=${YEAR}-12-20" >> $GITHUB_ENV
"12")
set_env_vars ${SEASONS[$MONTH]} "${YEAR}-09-21" "${YEAR}-12-20"
;;
esac
- name: Write scheduled post
Expand Down

0 comments on commit cb27074

Please sign in to comment.