mirror #1619
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: mirror | |
on: | |
schedule: | |
- cron: '0 */12 * * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Read api.github.com and filter response | |
run: | | |
cd docs/mirror | |
export JQ_FILTER="[.[] | {tag_name: .tag_name, assets: [.assets[] | {browser_download_url: .browser_download_url} ] } ]" | |
curl -H "Authorization: ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/mozilla/geckodriver/releases | jq "$JQ_FILTER" > geckodriver | |
curl -H "Authorization: ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/operasoftware/operachromiumdriver/releases | jq "$JQ_FILTER" > operadriver | |
curl -H "Authorization: ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/SeleniumHQ/selenium/releases | jq "$JQ_FILTER" > selenium | |
- name: Commit files | |
id: git | |
run: | | |
export CHANGES=$(git status -s) | |
if [ -n "$CHANGES" ]; then | |
git config --local user.email "[email protected]" | |
git config --local user.name "Boni Garcia" | |
git add * | |
git commit -m "Update mirror info (`date`)" -a | |
echo "::set-output name=commit::true" | |
fi | |
- name: Push changes | |
if: steps.git.outputs.commit == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |