Matrix Docker Ansible eploy
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

156 righe
5.5 KiB

  1. # SPDX-FileCopyrightText: 2026 Slavi Pantaleev
  2. #
  3. # SPDX-License-Identifier: AGPL-3.0-or-later
  4. ---
  5. name: Renovate
  6. on: # yamllint disable-line rule:truthy
  7. schedule:
  8. # Discover new updates hourly. Reactive runs below drain active updates.
  9. - cron: '17 * * * *'
  10. workflow_dispatch:
  11. inputs:
  12. dry_run:
  13. description: 'Run without making changes'
  14. required: false
  15. default: true
  16. type: boolean
  17. log_level:
  18. description: 'Renovate log level'
  19. required: false
  20. default: 'info'
  21. type: choice
  22. options:
  23. - info
  24. - debug
  25. - trace
  26. push:
  27. branches: ['master']
  28. workflow_run:
  29. workflows: ['Matrix CI', 'Matrix i18n', 'Molecule']
  30. types: [completed]
  31. branches: ['renovate/**']
  32. issues:
  33. types: [edited]
  34. permissions:
  35. contents: read
  36. env:
  37. # Mend-hosted Renovate must remain disabled while this automation is enabled.
  38. # A manual dry-run remains available if this switch is disabled during migration.
  39. MATRIX_RENOVATE_AUTOMATION_ENABLED: 'true'
  40. # renovate: datasource=docker depName=matrix-renovate-runner packageName=ghcr.io/renovatebot/renovate
  41. MATRIX_RENOVATE_VERSION: '44.51.2'
  42. jobs:
  43. preflight:
  44. name: Decide whether to run Renovate
  45. runs-on: ubuntu-latest
  46. outputs:
  47. should_run: ${{ steps.decision.outputs.should_run }}
  48. steps:
  49. - name: Evaluate trigger
  50. id: decision
  51. shell: bash
  52. env:
  53. GH_TOKEN: ${{ github.token }}
  54. EVENT_NAME: ${{ github.event_name }}
  55. EVENT_REF: ${{ github.ref }}
  56. MANUAL_DRY_RUN: ${{ inputs.dry_run }}
  57. WORKFLOW_RUN_CONCLUSION: ${{ github.event.workflow_run.conclusion }}
  58. WORKFLOW_RUN_EVENT: ${{ github.event.workflow_run.event }}
  59. ISSUE_TITLE: ${{ github.event.issue.title }}
  60. SENDER_TYPE: ${{ github.event.sender.type }}
  61. run: |
  62. set -euo pipefail
  63. should_run=false
  64. reason='Automatic Renovate processing is disabled during migration'
  65. if [[ "$EVENT_NAME" == 'workflow_dispatch' ]]; then
  66. if [[ "$EVENT_REF" != 'refs/heads/master' ]]; then
  67. reason='Manual runs must use the master branch'
  68. elif [[ "$MANUAL_DRY_RUN" == 'true' || "$MATRIX_RENOVATE_AUTOMATION_ENABLED" == 'true' ]]; then
  69. should_run=true
  70. reason='Running manually requested Renovate job'
  71. else
  72. reason='Enable automatic processing before requesting a write run'
  73. fi
  74. elif [[ "$MATRIX_RENOVATE_AUTOMATION_ENABLED" == 'true' ]]; then
  75. case "$EVENT_NAME" in
  76. schedule)
  77. should_run=true
  78. reason='Running scheduled update discovery'
  79. ;;
  80. workflow_run)
  81. if [[ "$WORKFLOW_RUN_CONCLUSION" == 'success' && "$WORKFLOW_RUN_EVENT" == 'push' ]]; then
  82. should_run=true
  83. reason='A Renovate branch passed one of its status-check workflows'
  84. else
  85. reason='The completed check was not a successful Renovate branch push'
  86. fi
  87. ;;
  88. issues)
  89. if [[ "$ISSUE_TITLE" == 'Dependency Dashboard' && "$SENDER_TYPE" == 'User' ]]; then
  90. should_run=true
  91. reason='A user edited the Dependency Dashboard'
  92. else
  93. reason='The issue edit was not a user editing the Dependency Dashboard'
  94. fi
  95. ;;
  96. push)
  97. renovate_branch_count="$(
  98. gh api \
  99. "repos/$GITHUB_REPOSITORY/git/matching-refs/heads/renovate" \
  100. --jq 'length'
  101. )"
  102. if (( renovate_branch_count > 0 )); then
  103. should_run=true
  104. reason="master changed while ${renovate_branch_count} Renovate branch(es) exist"
  105. else
  106. reason='master changed, but there are no Renovate branches to process'
  107. fi
  108. ;;
  109. esac
  110. fi
  111. echo "should_run=$should_run" >> "$GITHUB_OUTPUT"
  112. echo "$reason"
  113. renovate:
  114. name: Renovate
  115. needs: preflight
  116. if: needs.preflight.outputs.should_run == 'true'
  117. runs-on: ubuntu-latest
  118. environment: main
  119. concurrency:
  120. group: renovate
  121. cancel-in-progress: false
  122. steps:
  123. - name: Create Renovate App token
  124. id: renovate_token
  125. uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
  126. with:
  127. client-id: ${{ vars.GH_APP_RENOVATE_CLIENT_ID }}
  128. private-key: ${{ secrets.GH_APP_RENOVATE_PRIVATE_KEY }}
  129. - name: Run Renovate
  130. uses: renovatebot/github-action@5402b206248e5a8c8427a15102702eb9c1793efc # v46.2.4
  131. with:
  132. token: ${{ steps.renovate_token.outputs.token }}
  133. renovate-version: ${{ env.MATRIX_RENOVATE_VERSION }}
  134. env:
  135. LOG_LEVEL: ${{ inputs.log_level || 'info' }}
  136. RENOVATE_DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run && 'full' || '' }}
  137. # Permit the self-hosted App to adopt branches created by the Mend-hosted App.
  138. RENOVATE_GIT_IGNORED_AUTHORS: '["29139614+renovate[bot]@users.noreply.github.com"]'
  139. RENOVATE_IGNORE_PR_AUTHOR: 'true'
  140. RENOVATE_PLATFORM: github
  141. RENOVATE_PLATFORM_COMMIT: enabled
  142. RENOVATE_REPOSITORIES: ${{ github.repository }}