name: Update install-jdk.properties

on:
  push:
    paths:
      - '.github/workflows/install-jdk-update.yml'
      - 'install-jdk.sh'
  schedule:
    - cron:  '23 */4 * * *'

jobs:
  update:
    runs-on: ubuntu-latest
    steps:
      - name: 'Checkout sources'
        uses: actions/checkout@v2

      - name: 'Configure git user'
        run: |
          git config --local user.email 'action@github.com'
          git config --local user.name 'GitHub Action'

      - name: 'Set up Java'
        uses: actions/setup-java@v1
        with:
          java-version: 11

      - name: 'Show JDK builds published at https://jdk.java.net'
        id: update
        run: |
          java src/bach/ShowJdkBuilds.java > install-jdk.properties
          cat install-jdk.properties

      - name: 'Check for modifications'
        id: diff
        run: |
          git diff
          echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo 'false'; else echo 'true'; fi)

      - name: 'Commit and push changed install-jdk.properties'
        if: steps.diff.outputs.modified == 'true'
        run: |
          git commit --message 'Update install-jdk.properties' install-jdk.properties
          git push

name: Update install-jdk.properties

on:
  push:
    paths:
      - '.github/workflows/install-jdk-update.yml'
      - 'install-jdk.sh'
  schedule:
    - cron:  '23 */4 * * *'

jobs:
  update:
    runs-on: ubuntu-latest
    timeout-minutes: 11
    steps:
      - name: 'Checkout sources'
        uses: actions/checkout@v2

      - name: 'Configure git user'
        run: |
          git config --local user.email 'action@github.com'
          git config --local user.name 'GitHub Action'

      - name: 'Set up Java'
        uses: actions/setup-java@v1
        with:
          java-version: 11

      - name: 'Show JDK builds published at https://jdk.java.net'
        id: update
        run: |
          java src/bach/ShowJdkBuilds.java > install-jdk.properties
          cat install-jdk.properties

      - name: 'Check for modifications'
        id: diff
        run: |
          git diff
          echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo 'false'; else echo 'true'; fi)

      - name: 'Commit and push changed install-jdk.properties'
        if: steps.diff.outputs.modified == 'true'
        run: |
          git commit --message 'Update install-jdk.properties' install-jdk.properties
          git push

Set timeout to 11 minutes
Set timeout to 11 minutes