Daily Problem #3696
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: Daily Problem | |
on: | |
schedule: | |
- cron: '*/5 23,00 * * *' | |
# This command allows us to run the Action automatically from the Actions tab. | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
Get_Daily_Problem: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repo content | |
uses: actions/checkout@v3 # checkout the repository content to github runner | |
- name: Fetch Daily Problem from LeetCode | |
run: sudo python .github/scripts/Fetch_Daily_Problem.py | |
- name: Check if there are any changes | |
id: verify_diff | |
run: | | |
if [ -n "$(git status --porcelain)" ]; | |
then echo "IS_VALID=true" >> $GITHUB_ENV; | |
else echo "IS_VALID=false" >> $GITHUB_ENV; | |
fi | |
- name: Commit and Add Changes | |
if: ${{ env.IS_VALID == 'true' }} | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "7oSkaaa" | |
git add . | |
git commit -am 'Add new daily problem' | |
- name: Push | |
if: ${{ env.IS_VALID == 'true' }} | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
force_with_lease: true |