Skip to content

pull string-utils from tegonal-scripts required by release-template #162

pull string-utils from tegonal-scripts required by release-template

pull string-utils from tegonal-scripts required by release-template #162

Workflow file for this run

#
# __ __
# / /____ ___ ____ ___ ___ _/ / This file is provided to you by https://github.com/tegonal/github-commons
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / Copyright 2022 Tegonal Genossenschaft <[email protected]>
# \__/\__/\_, /\___/_//_/\_,_/_/ It is licensed under Creative Commons Zero v1.0 Universal
# /___/ Please report bugs and contribute back your improvements
#
# Version: v4.2.0
###################################
name: Cleanup
#gt-placeholder-trigger-start
on:
push:
branches:
- main
#gt-placeholder-trigger-end
#gt-placeholder-permissions-start
permissions:
contents: read
#gt-placeholder-permissions-end
jobs:
build:
#gt-placeholder-runs-on-start
runs-on: ubuntu-latest
#gt-placeholder-runs-on-end
steps:
- uses: actions/checkout@v5
#gt-placeholder-install-dependencies-start
#gt-placeholder-install-dependencies-end
# start inserted via pull-hook.sh - modify there
- name: Setup JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
cache: sbt
- uses: sbt/setup-sbt@v1
# end inserted via pull-hook.sh - modify there
- name: Cleanup Sources
run: ./scripts/cleanup-on-push-to-main.sh
- name: Check if actor is collaborator
id: check-collaborator
run: |
user="${{ github.actor }}"
repo="${{ github.repository }}"
status=$(curl -s -o /dev/null -w '%{http_code}' \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$repo/collaborators/$user")
echo "status $status for user $user"
if [ "$status" = "204" ]; then
echo "reviewer=$user" >> $GITHUB_OUTPUT
else
echo "reviewer=" >> $GITHUB_OUTPUT
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Pull Request if necessary
uses: peter-evans/create-pull-request@v7
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
token: ${{ secrets.AUTO_PR_TOKEN }}
push-to-fork: ${{ vars.AUTO_PR_FORK_NAME != '' && vars.AUTO_PR_FORK_NAME || secrets.AUTO_PR_FORK_NAME }}
reviewers: ${{ steps.check-collaborator.outputs.reviewer }}