diff --git a/.github/update-date-in-last-update-badge.yml b/.github/update-date-in-last-update-badge.yml deleted file mode 100644 index 12206292..00000000 --- a/.github/update-date-in-last-update-badge.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Update date in last update badge -on: - push: - branches: - - master - -jobs: - run: - name: Update the date in last update badge to today - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v2 - - - name: Update last update badge - run: | - # Make file runnable - chmod +x "${GITHUB_WORKSPACE}/.github/update-last-update-badge.sh" - - # Run script - "${GITHUB_WORKSPACE}/.github/update-last-update-badge.sh" "${GITHUB_WORKSPACE}/README.md" - - - name: Commit changes - uses: EndBug/add-and-commit@v7 - if: env.DID_LAST_UPDATE_BADGE_UPDATED - with: - author_name: github-actions - author_email: 41898282+github-actions[bot]@users.noreply.github.com - message: 'update the last update badge to today [skip ci]' - add: 'README.md' \ No newline at end of file diff --git a/.github/workflows/update-date-in-last-update-badge.yml b/.github/workflows/update-date-in-last-update-badge.yml new file mode 100644 index 00000000..fd354c9a --- /dev/null +++ b/.github/workflows/update-date-in-last-update-badge.yml @@ -0,0 +1,32 @@ +name: Update date in last update badge +on: + push: + branches: + - master + +jobs: + run: + name: Update the date in last update badge to today + runs-on: ubuntu-20.04 + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Update last update badge + run: | + # Make file runnable + chmod +x "${GITHUB_WORKSPACE}/.github/workflows/update-last-update-badge.sh" + # Run script + "${GITHUB_WORKSPACE}/.github/workflows/update-last-update-badge.sh" "${GITHUB_WORKSPACE}/README.md" + + - name: Commit & Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + commit-message: update the last update badge to today [skip ci] + author: Update Last Update Badge Action <${{ github.actor }}@users.noreply.github.com> + branch: update-last-update-badge + delete-branch: true + title: 'Update last update badge to today [skip ci]' + + # Force empty body as the action have default body + body: '' diff --git a/.github/update-last-update-badge.sh b/.github/workflows/update-last-update-badge.sh similarity index 91% rename from .github/update-last-update-badge.sh rename to .github/workflows/update-last-update-badge.sh index 891141dc..66fd2510 100644 --- a/.github/update-last-update-badge.sh +++ b/.github/workflows/update-last-update-badge.sh @@ -33,16 +33,12 @@ is_last_update_badge_date_is_today() { fi } -set_update_result() { - echo "DID_LAST_UPDATE_BADGE_UPDATED=$1" >> $GITHUB_ENV -} - # We use already encoded string emoji because I'm on Windows and the calendar emoji failed to render CALENDAR_EMOJI_ENCODED='%F0%9F%93%85' # Date format example: March 03, 2021 -CURRENT_DATE=`date +"%B %m, %Y"` +CURRENT_DATE=`date +"%B %d, %Y"` # We explicitly matching the img.shields.io/badge because when we change the provider of the badge the input will be changed too LAST_UPDATE_BADGE_REGEX='