Merge pull request #493 from Arcturus22/Add #249
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 README | |
on: | |
push: | |
branches: | |
- main | |
- master | |
paths: | |
- 'participants/**/*.yml' | |
- 'update_readme.py' | |
schedule: | |
- cron: '0 0 1 1 *' | |
workflow_dispatch: | |
jobs: | |
ValidateYAML: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Validate YAML files | |
uses: SoftCreatR/[email protected] | |
ValidateLinks: | |
runs-on: ubuntu-latest | |
needs: [ValidateYAML] | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Set up Ruby 2.6 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.6 | |
- id: file-diff | |
uses: lots0logs/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Validate Links | |
run: | | |
FILELIST="" | |
for FILENAME in $(jq '.[]' $HOME/files.json); do | |
FILENAME="${FILENAME:1}" | |
FILENAME="${FILENAME::-1}" | |
if [ -f "$FILENAME" ] && [[ $FILENAME == *"participants"* ]] && [ "${FILENAME: -4}" == ".yml" ]; then | |
FILELIST+="$FILENAME," | |
else | |
echo "- Skipped $FILENAME" | |
fi | |
done | |
if [ -n "$FILELIST" ]; then | |
gem install awesome_bot | |
awesome_bot --files "$FILELIST" --allow-dupe --allow-redirect --skip-save-results | |
else | |
echo "Nothing to do." | |
fi | |
Main: | |
runs-on: ubuntu-latest | |
needs: [ValidateYAML, ValidateLinks] | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: python -m pip install -r requirements.txt | |
- name: Update README | |
run: python update_readme.py | |
- name: Commit and push on changes | |
run: |- | |
git pull | |
git add . | |
git diff | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git commit -m "Updated README" -a || echo "No changes to commit" | |
git push | |
UpdateContributors: | |
runs-on: ubuntu-latest | |
needs: [ValidateYAML, ValidateLinks, Main] | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- uses: BobAnkh/[email protected] | |
with: | |
REPO_NAME: 'benbarth/hacktoberfest-swag' | |
CONTRIBUTOR: '## Contributors ✨' | |
ACCESS_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
IGNORED_CONTRIBUTORS: 'Ben Barth,Sascha Greuel,Chandler Weiner' |