Skip to content

Commit 6d22b6d

Browse files
authored
feat(github/workflows): automatic switch logo (#1099)
Automate #948 and #965. Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>
1 parent 71c08c7 commit 6d22b6d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/switch-logo.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Switch Logo
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 31 5 *' # Change to pride logo. “At 00:00 on day-of-month 31 in May.”
6+
- cron: '0 0 1 7 *' # Switch back to normal logo. “At 00:00 on day-of-month 1 in July.”
7+
8+
jobs:
9+
swap-logo:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
13+
14+
- name: Switch Logo
15+
run: |
16+
TODAY=$(date +'%m-%d')
17+
if [ "$TODAY" == "05-31" ]; then
18+
# Switch to pride logo.
19+
sed --in-place 's|/images/nix-logo\.png|/images/nix-logo-pride.png|g' frontend/src/Main.elm
20+
git_commit_message="chore(logo): use pride logo"
21+
elif [ "$TODAY" == "07-01" ]; then
22+
# Switch back to normal logo.
23+
sed --in-place 's|/images/nix-logo-pride\.png|/images/nix-logo.png|g' frontend/src/Main.elm
24+
git_commit_message="chore(logo): switch back to normal logo"
25+
else
26+
echo "No action needed for logo today."
27+
exit 0
28+
fi
29+
30+
git config --global user.name 'github-actions[bot]'
31+
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
32+
git add frontend/src/Main.elm
33+
git commit --message "$git_commit_message"
34+
git push

0 commit comments

Comments
 (0)