-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hotfix to develop to fix the update_truth.yml workflow logic. This te…
…sting workflow run failed (https://github.com/dtcenter/MET/actions/runs/9209471209). Here we switch to a unique update truth branch name to avoid conflicts.
- Loading branch information
1 parent
cd2b429
commit 66dca0d
Showing
1 changed file
with
23 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,30 +32,46 @@ 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} | ||
if [[ -z "$(git ls-remote --heads origin ${branch_name}-ref)" ]]; then | ||
echo ERROR: ${branch_name}-ref does not exist | ||
exit 1 | ||
fi | ||
echo ${branch_name}-ref does exist -- update it | ||
git config --global user.name "metplus-bot" | ||
git config --global user.email "[email protected]" | ||
# checkout branch (develop or main_vX.Y) | ||
echo git checkout ${branch_name} | ||
git checkout ${branch_name} | ||
echo git checkout -b update_truth_for_${branch_name} | ||
git checkout -b update_truth_for_${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 | ||
echo git push origin update_truth_for_${branch_name} | ||
git push origin update_truth_for_${branch_name} | ||
# 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} | ||
echo git push origin ${update_branch} | ||
git push origin ${update_branch} | ||
- 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 }}<br/>Created by @${{ github.actor}} | ||
BODY: ${{ github.event.inputs.change_summary }}<br/>Created by @${{ github.actor }} | ||
TITLE: Update ${{ env.branch_name }}-ref after ${{ github.event.inputs.pull_requests }} |