Scrape latest jobs #576
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: Scrape latest jobs | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
- cron: '6 12 * * *' | |
jobs: | |
scheduled: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out this repo | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fetch latest data | |
run: |- | |
curl https://relocate-with-us.github.io/db.json | jq . > jobList.json | |
- name: Parse jobList.json into table | |
id: parse-json | |
run: | | |
cat << EOF > README.md | |
# Daily List of Visa-Sponsored Job Opportunities | |
Welcome to our repository of daily-updated, visa-sponsored job opportunities! This list is automatically refreshed every day to bring you the latest openings across various companies and locations. | |
🌟 **Check out our main site**: [Relocate With Us](https://relocate-with-us.github.io) | |
💬 **Join our Telegram channel**: [Relocate With Us Telegram](https://t.me/visa_sponsored_jobs) | |
We encourage the community to engage, share, and support each other in the job search process. If you find this resource helpful, please star the repository and spread the word! | |
EOF | |
echo "| Company | Job Title | Location | Added | Flag | Link |" >> README.md | |
echo "| --- | --- | --- | --- | --- | --- |" >> README.md | |
jq -r '.[] | | |
"| " + .company + | |
" | " + .position + | |
" | " + (.location | split(" ")[:-1] | join(" ")) + | |
" | " + .post_date + | |
" | " + (.location | split(" ")[-1]) + | |
" | " + "[Apply](" + .description + ")" + | |
" |"' jobList.json >> README.md | |
cat << EOF >> README.md | |
--- | |
Last updated: $(date -u) | |
*Note: This list is automatically updated daily. Check back often for new opportunities!* | |
EOF | |
- name: Commit and push if it changed | |
run: | | |
git config user.name "Automated" | |
git config user.email "[email protected]" | |
git add README.md | |
timestamp=$(date -u) | |
git commit -m "Latest jobs: ${timestamp}" || exit 0 | |
git stash | |
git pull --rebase | |
git stash pop | |
git push |