-
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
c43a24c
commit 33c5f1c
Showing
2 changed files
with
54 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,52 @@ | ||
name: Update README ⭐ | ||
on: | ||
schedule: | ||
- cron: "0 11 * 12 *" | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update-readme: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check year for cron | ||
if: github.event_name == 'schedule' | ||
run: | | ||
current_year=$(date +'%Y') | ||
if [ "$current_year" -ne "2024" ]; then | ||
echo "No longer 2024, delete this action's schedule." | ||
exit 1 | ||
fi | ||
- name: Check commit message for push | ||
id: check_commit_message | ||
if: github.event_name == 'push' | ||
continue-on-error: true | ||
run: | | ||
COMMIT_MESSAGE=$(git log -1 --pretty=%B) | ||
if ! [[ "$COMMIT_MESSAGE" =~ ^day\ [0-9]{2}$ ]]; then | ||
echo "Commit message does not match solution pattern" | ||
exit 1 | ||
fi | ||
- name: Update README stars | ||
id: update_readme_stars | ||
if: steps.check_commit_message.outcome == 'success' || github.event_name != 'push' | ||
uses: k2bd/advent-readme-stars@v1 | ||
with: | ||
userId: 4388690 | ||
year: 2024 | ||
sessionCookie: ${{ secrets.AOC_SESSION }} | ||
|
||
- name: Commit changes | ||
if: steps.update_readme_stars.outcome == 'success' | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: auto-update README stars |
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