name: Upstream sync # Once a day: if upstream has moved, pin its tip, re-apply our patches, build and test, and open (or refresh) # one pull request on bot/upstream-sync. Nothing is merged automatically. on: schedule: - cron: '17 3 * * *' # UTC workflow_dispatch: inputs: force: description: Rebuild and refresh the PR even if bot/upstream-sync already proposes the current upstream tip required: false default: 'false' concurrency: group: upstream-sync cancel-in-progress: false permissions: contents: write pull-requests: write # Organisation-wide Stratum settings (registry, group, runner routes) are organisation variables. env: STRATUM_PUBLISH_URL: ${{ vars.STRATUM_PUBLISH_URL }} STRATUM_RESOLVE_URL: ${{ vars.STRATUM_RESOLVE_URL }} STRATUM_GROUP_ID: ${{ vars.STRATUM_GROUP_ID }} STRATUM_ROUTES: ${{ vars.STRATUM_ROUTES }} STRATUM_LOCALE: ${{ vars.STRATUM_LOCALE }} jobs: sync: runs-on: ubuntu-latest timeout-minutes: 120 steps: - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 with: submodules: true - uses: ./.github/actions/setup-build - name: Bump upstream and re-apply patches id: bump env: FORCE_SYNC: ${{ inputs.force }} run: ./gradlew syncUpstream --no-daemon --console=plain - name: Build and test id: build if: ${{ steps.bump.outputs.changed == 'true' && steps.bump.outputs.apply == 'ok' }} continue-on-error: true run: ./gradlew build --args="--no-daemon --console=plain" --no-daemon --console=plain - name: Open or refresh the pull request if: ${{ steps.bump.outputs.changed == 'true' }} env: API_TOKEN: ${{ github.token }} BUILD_RESULT: ${{ steps.bump.outputs.apply != 'ok' && 'skipped' || (steps.build.outcome == 'success' && 'passed' || 'failed') }} run: ./gradlew syncPullRequest --no-daemon --console=plain - name: Fail the run when the sync needs attention if: ${{ steps.bump.outputs.changed == 'true' && (steps.bump.outputs.apply != 'ok' || steps.build.outcome != 'success') }} run: | echo "::error::upstream sync needs attention (patches: ${{ steps.bump.outputs.apply }}, build: ${{ steps.build.outcome }}); see the bot/upstream-sync pull request" exit 1