update-collection #31
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-collection | |
permissions: | |
contents: write | |
on: | |
pull_request: | |
types: [closed] | |
workflow_dispatch: | |
jobs: | |
update-collection: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 # Update to v3 for Node.js 20 support | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' # specify the PHP version | |
- name: Create config.php | |
working-directory: docs/updater | |
run: | | |
echo '<?php' > config.php | |
echo '// Configuration' >> config.php | |
echo "\$server = 'https://raw.githubusercontent.com/';" >> config.php | |
echo "\$repopath = 'eried/ArduboyCollection/'; // Source repository" >> config.php | |
echo '' >> config.php | |
echo '// Github credentials' >> config.php | |
echo "\$client_id='${{ secrets.CLIENT_ID }}';" >> config.php | |
echo "\$client_secret='${{ secrets.CLIENT_SECRET }}';" >> config.php | |
- name: Execute update.php | |
working-directory: docs/updater | |
run: php update.php | |
- name: Commit and Push changes | |
working-directory: docs | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add repo.json | |
git add index.html | |
git commit -m "Repo update" -a || echo "No changes to commit" | |
#git push https://${{ secrets.PAT }}@github.com/eried/ArduboyCollection.git | |
git push |