Styles for Halloween #19
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
name: Send Time-Based Message | |
on: | |
issues: | |
types: [opened] | |
pull_request: | |
types: [opened] | |
jobs: | |
send_message: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send message based on time (PRs) | |
if: github.event_name == 'pull_request' | |
run: | | |
HOUR=$(TZ=":America/Mexico_City" date +'%H') # Obtén la hora en GMT-6 (México) | |
if [ $HOUR -ge 7 ] && [ $HOUR -lt 15 ]; then | |
MESSAGE="Hi! During this time, the repo owner is a bit busier than usual. Don't worry if it takes a bit, they will review the code later." | |
elif [ $HOUR -ge 15 ] && [ $HOUR -lt 19 ]; then | |
MESSAGE="Your Pull Request will be reviewed soon, please be patient." | |
else | |
MESSAGE="The owner is currently occupied. Your PR will be reviewed later." | |
fi | |
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \ | |
-d "{\"body\":\"$MESSAGE\"}" | |
- name: Send message based on time (Issues) | |
if: github.event_name == 'issues' | |
run: | | |
HOUR=$(TZ=":America/Mexico_City" date +'%H') # Obtén la hora en GMT-6 (México) | |
if [ $HOUR -ge 7 ] && [ $HOUR -lt 15 ]; then | |
MESSAGE="Hi! During this time, the repo owner is a bit busier than usual. Don't worry if it takes a bit, they will review the issue later." | |
elif [ $HOUR -ge 15 ] && [ $HOUR -lt 19 ]; then | |
MESSAGE="Your issue will be reviewed soon, please be patient." | |
else | |
MESSAGE="The owner is currently occupied. Your issue will be reviewed later." | |
fi | |
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments \ | |
-d "{\"body\":\"$MESSAGE\"}" |