Medium Writeups #41794
This file contains hidden or 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: Medium Writeups | |
| on: | |
| schedule: | |
| - cron: '*/10 * * * *' | |
| push: | |
| branches: | |
| - main | |
| # Actions project permission | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.23.4' # Specify the version of Go you want to use | |
| - name: Scraping Medium Writeups | |
| run: | | |
| go run main.go | tee NEW-README.md | |
| - name: Deleting old README.md and rename NEW-README.md | |
| run: | | |
| rm -rf README.md && mv NEW-README.md README.md | |
| - name: Commit and push changes if there are any | |
| run: | | |
| git config --global user.name 'GitHub Actions' | |
| git config --global user.email '[email protected]' | |
| git add . | |
| # Check if there are changes before committing | |
| if ! git diff --cached --exit-code; then | |
| IST_DATE=$(TZ='Asia/Kolkata' date +'%a %b %d %H:%M:%S IST %Y') | |
| git commit -m "Updated List: $IST_DATE" | |
| git push | |
| else | |
| echo "No changes to commit" | |
| fi |