Update Results #60
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: Update Results | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 0' # runs every Sunday at midnight | |
jobs: | |
update-results: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Retrieve Internships table.md | |
run: | | |
curl -o internships_table.md https://raw.githubusercontent.com/LorenzoLaCorte/internship-scraper/main/output/output-internships/table.md | |
- name: Retrieve New Grads table.md | |
run: | | |
curl -o newgrads_table.md https://raw.githubusercontent.com/LorenzoLaCorte/internship-scraper/main/output/output-new-grads/table.md | |
- name: Check internships_table and newgrads_table content | |
run: | | |
if grep -q "404: Not Found" internships_table.md; then | |
echo "Error: Invalid content in internships_table.md" | |
exit 1 | |
fi | |
if grep -q "404: Not Found" newgrads_table.md; then | |
echo "Error: Invalid content in newgrads_table.md" | |
exit 1 | |
fi | |
- name: Update Results | |
run: | | |
echo "# European Tech Opportunities" > README.md | |
echo "A collection of tech internships, new grads, research opportunities and more." >> README.md | |
echo "" >> README.md | |
echo "## Index" >> README.md | |
echo "💼🇪🇺 [European Internship Positions](#internship-positions) | 🎓🇪🇺 [European New Grad Positions](#new-grad-positions)" >> README.md | |
echo "## Scraper" >> README.md | |
echo "[Check out the scraper repository](https://github.com/LorenzoLaCorte/internship-scraper)" >> README.md | |
echo "" >> README.md | |
echo "## Internship Positions" >> README.md | |
cat internships_table.md >> README.md | |
echo "" >> README.md | |
echo "## New Grad Positions" >> README.md | |
cat newgrads_table.md >> README.md | |
- name: Commit and push if it changed | |
run: | | |
git diff | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
git commit -am "Update Results" || exit 0 | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: "Update Results" | |
title: "Update Results" | |
body: "" | |
branch: "update-results" |