Sync with template repository #27721
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: Sync with template repository | |
on: | |
push: | |
paths: | |
- '.github/workflows/sync-with-template.yml' | |
- '.github/sync-with-template.yml' | |
- '.github/sync-with-template-local-transformations.yml' | |
branches: | |
- 'main' | |
- 'master' | |
schedule: | |
- cron: '24 1/4 * * *' # sync-with-template: adjust | |
workflow_dispatch: { } | |
defaults: | |
run: | |
shell: bash | |
env: | |
PUSH_BACK_TOKEN: ${{secrets.PUSH_BACK_TOKEN}} | |
jobs: | |
sync-with-template: | |
name: Sync with template repository | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
concurrency: | |
group: sync-with-template | |
cancel-in-progress: true | |
steps: | |
- name: Get rate limits | |
uses: remal-github-actions/get-rate-limits@v1 | |
id: rate-limits | |
with: | |
githubToken: ${{env.PUSH_BACK_TOKEN || github.token}} | |
- name: Make rate limits decision | |
id: decision | |
run: | | |
echo "Core rate limit usage: ${{steps.rate-limits.outputs.coreUsage}}" | |
if [ "${{steps.rate-limits.outputs.coreUsage < 75}}" == "true" ]; then | |
echo "Enough rate limits" | |
echo 'enough=true' >> $GITHUB_OUTPUT | |
else | |
echo "::warning::Not enough rate limits!" | |
if [ "${{github.event_name != 'schedule'}}" == "true" ]; then | |
echo "::warning::Executing anyway, as event is '${{github.event_name}}'" | |
echo 'enough=true' >> $GITHUB_OUTPUT | |
else | |
echo 'enough=false' >> $GITHUB_OUTPUT | |
fi | |
fi | |
- name: Sync with template repository | |
if: ${{env.PUSH_BACK_TOKEN && fromJSON(steps.decision.outputs.enough) == true}} | |
uses: remal-github-actions/sync-with-template@v3 | |
with: | |
githubToken: ${{env.PUSH_BACK_TOKEN}} | |
templateRepository: ${{secrets.TEMPLATE_REPOSITORY || ''}} |