Skip to content

Check source for changes #141

Check source for changes

Check source for changes #141

name: Check source for changes
on:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run'
required: false
default: false
type: boolean
permissions:
contents: write
pull-requests: write
jobs:
check_source_for_changes:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.12'
- name: Check for changes
id: check
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "changes<<$EOF" >> "$GITHUB_OUTPUT"
python3 ./.scripts/monitor_repository.py >> "$GITHUB_OUTPUT"
echo "$EOF" >> "$GITHUB_OUTPUT"
- name: Report
env:
CHANGES: ${{ steps.check.outputs.changes }}
run: |
echo "Changes:"
echo "$CHANGES"
- name: Check if branch already exists
id: check_branch_exists
if: steps.check.outputs.changes != '' && !inputs.dry_run
run: |
git fetch
if git branch -r | grep -q "origin/sync-with-original"; then
echo
echo "branch_exists=1" >> $GITHUB_OUTPUT
exit 1
fi
- name: Open PR
if: steps.check.outputs.changes != '' && steps.check_branch_exists.outputs != '1' && !inputs.dry_run
uses: peter-evans/[email protected]
with:
title: Sync with original
body: |
${{ steps.check.outputs.changes }}
labels: sync
branch: sync-with-original
branch-suffix: random
commit-message: Sync with original
delete-branch: true
assignees: ${{ github.repository_owner }}
draft: true