# inspired by rhinstaller/anaconda name: Trigger GitLab CI on: workflow_run: workflows: ["Tests"] types: [completed] jobs: trigger-gitlab: if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest env: SCHUTZBOT_SSH_KEY: ${{ secrets.SCHUTZBOT_SSH_KEY }} steps: - name: Report status uses: haya14busa/action-workflow_run-status@v1 - name: Clone repository uses: actions/checkout@v2 with: ref: ${{ github.event.workflow_run.head_sha }} fetch-depth: 0 # If the parent workflow belongs to a PR, create a new PR-# branch - name: Checkout branch (PR) if: ${{ github.event.workflow_run.pull_requests[0] != null }} run: | git checkout -b PR-${{ github.event.workflow_run.pull_requests[0].number }} - name: Checkout branch (branch) if: ${{ github.event.workflow_run.pull_requests[0] == null }} run: | git checkout ${{ github.event.workflow_run.head_branch }} - name: Push to gitlab run: | mkdir -p ~/.ssh echo "${SCHUTZBOT_SSH_KEY}" > ~/.ssh/id_rsa chmod 400 ~/.ssh/id_rsa touch ~/.ssh/known_hosts ssh-keyscan -t rsa gitlab.com >> ~/.ssh/known_hosts git remote add ci git@gitlab.com:osbuild/ci/osbuild.git git push -f ci