diff --git a/.github/update_truth_change_log.txt b/.github/update_truth_change_log.txt new file mode 100644 index 000000000..5f88d4774 --- /dev/null +++ b/.github/update_truth_change_log.txt @@ -0,0 +1 @@ +[20240523_15:48:19 develop] dtcenter/MET#2892 and dtcenter/MET#2899 - dtcenter/MET#2892 adds the TOTAL_DIR column to the vector line types. dtcenter/MET#2899 fixes a bug reading point observations using Python Embedding in PointStat and EnsembleStat diff --git a/.github/workflows/update_truth.yml b/.github/workflows/update_truth.yml index 4b8c310dd..ea937857b 100644 --- a/.github/workflows/update_truth.yml +++ b/.github/workflows/update_truth.yml @@ -32,6 +32,7 @@ jobs: fetch-depth: 0 token: ${{ secrets.METPLUS_BOT_TOKEN }} - name: Resolve conflicts between branch and branch-ref + id: resolve_conflicts run: | branch_name=${{ env.branch_name }} cd ${GITHUB_WORKSPACE} @@ -43,17 +44,52 @@ jobs: echo ${branch_name}-ref does exist -- update it git config --global user.name "metplus-bot" git config --global user.email "97135045+metplus-bot@users.noreply.github.com" + # checkout branch (develop or main_vX.Y) echo git checkout ${branch_name} git checkout ${branch_name} + + # merge -ref branch into branch (favoring branch changes) echo git merge -s ours origin/${branch_name}-ref git merge -s ours origin/${branch_name}-ref + + # push changes to branch (develop or main_vX.Y) echo git push origin ${branch_name} git push origin ${branch_name} + # create unique branch name to update *-ref branch + update_branch=update_${branch_name}_$(uuidgen | cut -d "-" -f1) + echo "update_branch=${update_branch}" >> $GITHUB_OUTPUT + + # create update branch from branch (develop or main_vX.Y) + echo git checkout -b ${update_branch} + git checkout -b ${update_branch} + + # create or append to file to track truth data changes + # and ensure that PR merge into *-ref branch triggered testing workflow + change_log_path=.github/update_truth_change_log.txt + change_entry="[$(date +%Y%m%d_%H:%M:%S) ${branch_name}] ${{ github.event.inputs.pull_requests }} - ${{ github.event.inputs.change_summary }}" + echo "${change_entry}" >> ${change_log_path} + + # add file if it does not already exist + cmd="git add ${change_log_path}" + echo $cmd + $cmd + + # commit changes to change log file + echo git commit ${change_log_path} + git commit -m "added entry to update truth change log: ${branch_name} ${{ github.event.inputs.pull_requests }}" ${change_log_path} + + # push changes to update branch on GitHub + cmd="git push origin ${update_branch}" + echo $cmd + $cmd + + # create pull request from $HEAD into $BASE - name: Create Pull Request - run: gh pr create --base $BASE --body "$BODY" --title "$TITLE" + run: gh pr create --head $HEAD --base $BASE --body "$BODY" --title "$TITLE" env: GH_TOKEN: ${{ github.token }} + HEAD: ${{ steps.resolve_conflicts.outputs.update_branch }} BASE: ${{ env.branch_name }}-ref BODY: ${{ github.event.inputs.change_summary }}
Created by @${{ github.actor}} TITLE: Update ${{ env.branch_name }}-ref after ${{ github.event.inputs.pull_requests }}