Check Commits #92723
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: Check Commits | |
on: | |
schedule: | |
- cron: "*/5 * * * *" | |
workflow_dispatch: | |
jobs: | |
run_and_commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
- name: Install dependencies | |
run: npm i | |
- name: Run bot script | |
run: | | |
export BOT_TOKEN=${{ secrets.BOT_TOKEN }} | |
export GH_TOKEN=${{ secrets.GH_TOKEN }} | |
export CHANNEL_ID=${{ secrets.CHANNEL_ID }} | |
npm run build && npm run start | |
- name: Check if last_commit_date.txt has changed and commit | |
run: | | |
if git diff --exit-code last_commit_date.txt > /dev/null; then | |
echo "No changes detected in last_commit_date.txt" | |
else | |
eval "$(ssh-agent -s)" | |
ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}" | |
git config --global user.name "casoGithubBot" | |
git config --global user.email "[email protected]" | |
git add last_commit_date.txt | |
git commit -m "Update last_commit_date.txt" | |
git push --set-upstream [email protected]:${{ github.repository }}.git ${{ github.head_ref }} | |
fi |