Update source images #38292
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 source images | |
on: | |
schedule: | |
- cron: '45 * * * *' | |
jobs: | |
update: | |
name: Update source code | |
runs-on: Ubuntu-20.04 | |
steps: | |
- name: Fetch data | |
id: fetch | |
run: | | |
repos=$(curl -s https://raw.githubusercontent.com/async-aws/aws/master/README.md | grep -oP '^\| \[[^!\]]+\]\(https://github\.com/async-aws/\K[^)]+') | |
echo "Here are the listed repos: $repos" | |
echo ::set-output name=repos::$repos | |
- name: Set up PHP | |
uses: shivammathur/[email protected] | |
with: | |
php-version: 7.4 | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Download dependencies | |
run: | | |
composer install --no-interaction --prefer-dist --optimize-autoloader | |
- name: Compare & Print | |
run: | | |
for REPOSITORY in ${{ steps.fetch.outputs.repos }} | |
do | |
echo ::group::async-aws/$REPOSITORY | |
git clone --branch master https://${{ secrets.BOT_GITHUB_TOKEN }}:[email protected]/async-aws/$REPOSITORY/ output | |
cd output | |
count=$(git rev-list --count $(git describe --abbrev=0 --tags)..HEAD) | |
cd .. | |
rm -rf output | |
php src/image.php $REPOSITORY $count | |
echo ::endgroup:: | |
done | |
- name: Commit changes | |
run: | | |
echo "::group::git status" | |
git status | |
echo "::endgroup::" | |
git add -N docs | |
if [[ $(git diff --numstat | wc -l) -eq 0 ]]; then | |
echo "No changes found. Exiting." | |
exit 0; | |
fi | |
git config --local user.email "[email protected]" | |
git config --local user.name "AsyncAWS Bot" | |
echo "::group::git push" | |
git add docs/* | |
git commit -m "Update images with new data" | |
echo "::endgroup::" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.BOT_GITHUB_TOKEN }} | |