Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created by georgemccabe\n"abc cdf sdfsdafs" #1

Closed
wants to merge 9 commits into from
30 changes: 23 additions & 7 deletions .github/workflows/update_truth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Update Truth Data
on:
workflow_dispatch:
inputs:
pull_request:
pull_requests:
description: 'Pull request(s) that warranted update, e.g. #123 dtcenter/MET#123'
required: true
change_summary:
Expand All @@ -18,25 +18,41 @@ jobs:
- name: Check if branch is valid
run: |
branch_name=${GITHUB_REF#refs/heads/}
echo "branch_name=$branch_name" >> $GITHUB_ENV
if [[ $branch_name == "develop" ]]; then exit 0; fi
if [[ $branch_name =~ ^main_v[0-9]+\.[0-9]+$ ]]; then exit 0; fi
echo Branch is $branch_name - must be develop or match main_vX.Y
exit 1
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check if ref branch exists
run: |
branch_name=${GITHUB_REF#refs/heads/}
branch_name=${{ env.branch_name }}
cd ${GITHUB_WORKSPACE}
if [[ -z "$(git ls-remote --heads origin ${branch_name}-ref)" ]]; then
echo ${branch_name}-ref does not exist -- create it from $branch_name
echo git checkout -b ${branch_name}-ref
git checkout -b ${branch_name}-ref
echo git push origin ${branch_name}-ref
git push origin ${branch_name}-ref
else
echo ${branch_name}-ref does exist -- update it
echo git merge -s ours ${branch_name}-ref
echo git push origin ${branch_name}
exit $?
fi
echo Title: Update ${branch_name}-ref after ${{ github.event.inputs.pull_request }}

echo ${branch_name}-ref does exist -- update it
echo git checkout ${branch_name}
git checkout ${branch_name}
echo git merge -s ours origin/${branch_name}-ref
git merge -s ours origin/${branch_name}-ref
echo git push origin ${branch_name}
git push origin ${branch_name}
echo Title: Update ${branch_name}-ref after "${{ github.event.inputs.pull_requests }}"
echo Body: Change summary: ${{ github.event.inputs.change_summary }}

- name: Create Pull Request
run: gh pr create --base $BASE --body "$BODY" --title "$TITLE"
env:
GH_TOKEN: ${{ github.token }}
BASE: ${{ env.branch_name }}-ref
BODY: Update ${branch_name}-ref after "${{ github.event.inputs.pull_requests }}"
TITLE: Created by ${{ github.actor}}\n"${{ github.event.inputs.change_summary }}"