Skip to content

Commit

Permalink
Merge pull request #33 from opencrvs/fix-fix
Browse files Browse the repository at this point in the history
Fix fix
  • Loading branch information
adskyiproger authored Feb 27, 2025
2 parents 76ffac8 + 16796d9 commit c2bb166
Showing 1 changed file with 42 additions and 32 deletions.
74 changes: 42 additions & 32 deletions .github/workflows/on-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
FORK_REPOSITORY_NAME: ${{ secrets.FORK_REPOSITORY_NAME }}
FORK_REPOSITORY_PATH: "${{ secrets.FORK_REPOSITORY_ORGANISATION }}/${{ secrets.FORK_REPOSITORY_NAME }}"
steps:
- name: Checkout OpenCRVS Countryconfig repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}
# - name: Checkout OpenCRVS Countryconfig repository
# uses: actions/checkout@v4
# with:
# ref: ${{ github.event.pull_request.base.ref }}

- name: Check if PR branch exists in Farajaland repository
id: check_branch
Expand All @@ -34,32 +34,42 @@ jobs:
echo "branch_exists=false" >> $GITHUB_ENV
fi
- name: Sync Farajaland Forkrepository
id: sync_fork
if: env.branch_exists == 'true'
continue-on-error: true
run: |
gh repo sync ${FORK_REPOSITORY_PATH} --branch ${BASE_BRANCH}
# - name: Sync Farajaland Forkrepository
# id: sync_fork
# if: env.branch_exists == 'true'
# continue-on-error: true
# run: |
# gh repo sync ${FORK_REPOSITORY_PATH} --branch ${BASE_BRANCH}
# - name: Create Pull Request
# id: cpr
# uses: peter-evans/create-pull-request@v7
# with:
# base: ${{ github.event.pull_request.base.ref }}
# head: opencrvs:${BASE_BRANCH}
# title: "Update Farajaland from ${BASE_BRANCH}"
# body: |
# This PR updates the ${BASE_BRANCH} branch with the latest changes from the original repository opencrvs:${BASE_BRANCH}
# token: ${{ secrets.FORK_ORGANISATION_TOKEN }}

- name: Create PR in ${{ secrets.FORK_REPOSITORY_ORGANISATION }}/${{ secrets.FORK_REPOSITORY_NAME }}
if: steps.sync_fork.outcome == 'failure'
continue-on-error: true
run: |
echo "The 'sync_fork' step failed. Creating a PR in ${SYNC_FORK_REPOSITORY_PATH}"
gh pr create \
--repo ${FORK_REPOSITORY_PATH} \
--base ${BASE_BRANCH} \
--head opencrvs:${BASE_BRANCH} \
--title "Update Farajaland from ${BASE_BRANCH}" \
--body \
"""
This PR updates the ${BASE_BRANCH} branch with the latest changes from
the original repository opencrvs:${BASE_BRANCH}.
""" 1>result.txt 2>&1; _res=$?
if [ $? -eq 0 ]; then
printf "PR created successfully: $(grep ${FORK_REPOSITORY_PATH} result.txt)\n"
else
grep ${FORK_REPOSITORY_PATH} result.txt 1>/dev/null &&\
printf "PR already exists: $(grep ${FORK_REPOSITORY_PATH} result.txt)\n" ||\
echo "Failed to create PR"
fi
# - name: Create PR in ${{ secrets.FORK_REPOSITORY_ORGANISATION }}/${{ secrets.FORK_REPOSITORY_NAME }}
# if: steps.sync_fork.outcome == 'failure'
# continue-on-error: true
# run: |
# echo "The 'sync_fork' step failed. Creating a PR in ${SYNC_FORK_REPOSITORY_PATH}"
# gh pr create \
# --repo ${FORK_REPOSITORY_PATH} \
# --base ${BASE_BRANCH} \
# --head opencrvs:${BASE_BRANCH} \
# --title "Update Farajaland from ${BASE_BRANCH}" \
# --body \
# """
# This PR updates the ${BASE_BRANCH} branch with the latest changes from
# the original repository opencrvs:${BASE_BRANCH}.
# """ 1>result.txt 2>&1; _res=$? || true
# if [ $_res -eq 0 ]; then
# printf "PR created successfully: $(grep ${FORK_REPOSITORY_PATH} result.txt)\n"
# else
# grep ${FORK_REPOSITORY_PATH} result.txt 1>/dev/null &&\
# printf "PR already exists: $(grep ${FORK_REPOSITORY_PATH} result.txt)\n" ||\
# echo "Failed to create PR"
# fi

0 comments on commit c2bb166

Please sign in to comment.