Remove Expired Jobs #652
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: Remove Expired Jobs | |
on: | |
schedule: | |
# Run nightly 1am | |
- cron: 0 1 * * * | |
jobs: | |
clean-jobs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install required packages | |
run: | | |
pip install requests pyaml urlchecker | |
- name: Remove Expired Jobs | |
run: | | |
python scripts/clean_jobs.py | |
- name: Run URLs-checker | |
uses: urlstechie/[email protected] | |
with: | |
# A comma-separated list of file types to cover in the URL checks | |
file_types: .md,.py,.yml | |
# Choose whether to include file with no URLs in the prints. | |
print_all: false | |
# More verbose summary at the end of a run | |
verbose: true | |
# How many times to retry a failed request (defaults to 1) | |
retry_count: 3 | |
# Google Forms is having enormous timeouts | |
timeout: 10 | |
# Exclude these patterns from the checker | |
exclude_patterns: supercomputing.org,https://pace.gatech.edu,https://www.linkedin.com,jobs.colorado.edu,zoom.us,danielskatz.org,usrse.github.io.wiki.git,ornl.gov,jobs.bnl.gov,https://www.rd-alliance.org/,https://uwhires.admin.washington.edu/,https://twitter.com/,https://careers.umich.edu/ | |
# Exclude these files from the checker | |
exclude_files: README.md,SocialNetworks.yml,map.yml,_config.yml,tests/test_,.github/workflows,_posts/newsletters/ | |
- name: Push Fixes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
printf "GitHub Actor: ${GITHUB_ACTOR}\n" | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
git add _data/jobs.yml _data/related-jobs.yml | |
set +e | |
git status | grep modified | |
if [ $? -eq 0 ]; then | |
set -e | |
printf "Changes\n" | |
git commit -m "Automated push to update jobs files $(date '+%Y-%m-%d')" || exit 0 | |
git push origin main | |
else | |
set -e | |
printf "No changes\n" | |
fi |