-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chores: updated and new workflows (update-date.yml)
- Loading branch information
1 parent
d1f2cae
commit 48278ad
Showing
5 changed files
with
60 additions
and
9 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
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
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
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,32 @@ | ||
name: Update Date | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
paths-ignore: | ||
- '.github/**' | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.PAT }} # You need to create your own token with commit rights | ||
ref: ${{ github.ref }} # The branch you want to commit to | ||
|
||
- name: Update Files | ||
run: ./.github/workflows/updateDate.sh | ||
shell: bash | ||
|
||
- name: Push changes | ||
uses: EndBug/add-and-commit@v9 | ||
if: ${{ '<!-- `date "+%d/%m/%y"` -->' != '`tail -n 1 README.md`' }} | ||
with: | ||
committer_name: GitHub Actions | ||
committer_email: actions@github.com | ||
add: . | ||
message: 'docs: Updating Date' |
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 @@ | ||
#!/bin/sh | ||
|
||
DaySuffix() { | ||
case `date +%d` in | ||
01|21|31) echo "st";; | ||
02|22) echo "nd";; | ||
03|23) echo "rd";; | ||
*) echo "th";; | ||
esac | ||
} | ||
|
||
oldDate=`head -n 1 README.md` | ||
newDate=`date "+ updated: %A, %d\`DaySuffix\` %B %Y"` | ||
lastLine='<!-- '`date "+%d/%m/%y"`' -->' | ||
|
||
sed -i "1s/.*/$newDate/" README.md | ||
echo Date Updated | ||
sed -i "$ d" README.md | ||
echo $lastLine >> README.md |