Skip to content

Test/failing workload test #134

Test/failing workload test

Test/failing workload test #134

name: PRs to Main
on:
pull_request:
branches: [main]
types: [closed]
jobs:
merge-master-back-to-dev:
if: github.event.pull_request.merged == false
timeout-minutes: 2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: developer_branch
- name: Set Git config
run: |
git config --local user.email "dev@null"
git config --local user.name "CI Bot"
- name: Remove new ConfigMap
run: |
# Pull files down into a filename array
files=$(curl -s "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | jq -r '.[].filename')
echo $files
filearr=($files)
subdirectory=$(dirname ${filearr[0]})
# Find Namespace File in uploads list or in modified file subdirectory
if [ -z $namespace_file ]; then
if [ -f "${subdirectory}/namespace.yaml" ]; then
namespace_file="${subdirectory}/namespace.yaml"
echo "updated namespace file = $namespace_file"
elif [echo "$files" | grep "namespace.yaml"]; then
namespace_file=$(echo "$files" | grep "namespace.yaml") || echo "No Namespace File Found" && exit 200
else
echo "No Namespace file found in commit or subdirectory"
exit 200
fi
else
echo "namespace File = $namespace_file"
fi
if [ -n "$namespace_file" ]; then
subdirectory=$(dirname $namespace_file)
namespace_name=$(grep -E '^\s*metadata:\s*$|^\s*name:\s*' "$namespace_file" | awk -F':' '{gsub(/ /, "", $2); print $2}')
namespace=$(echo $namespace_name | xargs echo -n)
echo "Sub Directory = $subdirectory"
git config --local user.email "dev@null"
git config --local user.name "Conformitron Bot"
# revert Git commits [This removes 184 files then adds 180 back in that weren't in the PR, checking out better method]
git fetch origin developer_branch
git checkout developer_branch
commits=$(git log -1 --format=format:"%H" --all)
echo "commits: $(git log -1 --format=format:"%H" --all)"
git revert $commits
git push
else
echo "No ConfigMap found"
exit 200
fi
- name: Merge main back to dev
run: |
git fetch origin main:main
git checkout developer_branch
git merge main --no-edit --allow-unrelated-histories --strategy-option=theirs
git checkout --force main .
git push origin developer_branch