Sync #95
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 | |
on: | |
schedule: | |
- cron: "17 12 * * *" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
branch: | |
- master | |
env: | |
upstream: https://gitlab.com/gitlab-org/docker-distribution-pruner.git | |
GH_TOKEN: ${{ github.token }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ matrix.branch }} | |
- name: Create target branch if missing | |
run: | | |
git checkout -b upstream-${{ matrix.branch }} \ | |
&& git push origin upstream-${{ matrix.branch }} || : | |
- name: Fetch branch latest | |
shell: bash | |
run: | | |
git remote add upstream ${{ env.upstream }} | |
git remote -v | |
git fetch upstream ${{ matrix.branch }} | |
git rebase --autosquash --autostash upstream/${{ matrix.branch }} | |
git push --force origin upstream-${{ matrix.branch }} | |
gh pr create \ | |
--title "Sync upstream branch ${{ matrix.branch }}" \ | |
--fill-verbose \ | |
--base "${{ matrix.branch }}" || : |