Skip to content

Latest commit

 

History

History
 
 

workflows

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
name: Sync README.md

on:
  workflow_dispatch:
  schedule:
    - cron: '0 16 * * *'

jobs:
  Sync:

    name: Sync README.md

    runs-on: ubuntu-20.04

    steps:
      - name: Checkout code
        uses: actions/[email protected]
        with:
          fetch-depth: 0

      - name: Compare with Gitlab
        run: |
          GITLAB=$(wget -qO- https://gitlab.com/fscarmen/warp/-/raw/main/README.md | md5sum)
          GITHUB=$(wget -qO- https://raw.githubusercontent.com/fscarmen/warp-sh/main/README.md | md5sum)
          if [ "$GITLAB" != "$GITHUB" ]; then
            wget -O README.md https://gitlab.com/fscarmen/warp/-/raw/main/README.md
            git checkout --orphan tmp_work
            git branch -d ${GITHUB_REF#refs/heads/}
            echo "DATE=$(date "+%Y/%m/%d %H:%M:%S")" >> $GITHUB_ENV
          fi

      - name: Update README.md
        if: ${{ env.DATE != '' }}
        uses: stefanzweifel/[email protected]
        with:
          commit_message: Auto renew by Github Actions, ${{ env.DATE }}
          create_branch: true
          branch: main
          push_options: --force

      - name: Delete old workflow runs
        uses: MajorScruffy/[email protected]
        env:
          GITHUB_TOKEN: ${{ github.token }}
        with:
          repository: ${{ github.repository }}
          older-than-seconds: 3600