From 0db707c3f02e1ff717673d40a23b5df4e7266a43 Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Tue, 27 Aug 2024 16:09:34 +0200 Subject: [PATCH] try out push via ssh --- .github/workflows/cleanup.yml | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/cleanup.yml diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml new file mode 100644 index 0000000..a864122 --- /dev/null +++ b/.github/workflows/cleanup.yml @@ -0,0 +1,54 @@ +# +# __ __ +# / /____ ___ ____ ___ ___ _/ / This file is provided to you by https://github.com/tegonal/github-commons +# / __/ -_) _ `/ _ \/ _ \/ _ `/ / Copyright 2022 Tegonal Genossenschaft +# \__/\__/\_, /\___/_//_/\_,_/_/ It is licensed under Creative Commons Zero v1.0 Universal +# /___/ Please report bugs and contribute back your improvements +# +# Version: v2.6.0 +################################### +name: Cleanup + +on: + push: + branches: + - test + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Cleanup Sources + run: echo "hello world" > dummy.txt + - name: Start ssh-agent + id: start_ssh_agent + run: | + if [[ -z $SSH_AUTH_SOCK ]] + then + echo "Starting agent." + LOCAL_SSH_AUTH_SOCK=$(mktemp -t ssh-agent-XXXXXXXXXX) + echo "SSH_AUTH_SOCK=${LOCAL_SSH_AUTH_SOCK}" >> $GITHUB_ENV + ssh-agent -a $LOCAL_SSH_AUTH_SOCK > /dev/null + else + echo "Agent is already running." + fi + + - name: "Add ssh key" + id: add_ssh_key + run: | + if [[ -n $PRIVATE_KEY ]] + then + echo "Adding private key." + ssh-add - <<< "${{ secrets.AUTO_PR_DEPLOY_KEY }}" + fi + + - name: Create Pull Request if necessary + uses: peter-evans/create-pull-request@v6 + with: + branch: auto-cleanup + title: Auto Cleanup + commit-message: auto cleanup sources + body: Looks like someone forgot to run ./scripts/cleanup-on-push-to-main.sh before committing. I did it for them :) + delete-branch: true + push-to-fork: ${{ vars.AUTO_PR_FORK_NAME != '' && vars.AUTO_PR_FORK_NAME || secrets.AUTO_PR_FORK_NAME }}