Skip to content

Commit

Permalink
Merge pull request #456 from opencrvs/ocrvs-8716
Browse files Browse the repository at this point in the history
fix: Replaced default GITHUB_TOKEN with repository level fine gained token
  • Loading branch information
adskyiproger authored Feb 28, 2025
2 parents 3b56e61 + fb0cd4c commit db8620b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/on-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
- name: Create PR in ${{ secrets.FORK_REPOSITORY_ORGANISATION }}/${{ secrets.FORK_REPOSITORY_NAME }}
if: steps.sync_fork.outcome == 'failure'
id: create_pr
run: |
echo "The 'sync_fork' step failed. Creating a PR in ${SYNC_FORK_REPOSITORY_PATH}"
if gh pr create \
Expand All @@ -87,23 +88,20 @@ jobs:
echo RESULT=$(grep ${FORK_REPOSITORY_PATH} result.txt) >> $GITHUB_ENV
echo STATUS="Created" >> $GITHUB_ENV
elif grep -q "No commits" result.txt; then
printf "No commits between develop and develop: $(cat result.txt)\n"
printf "No commits between branches: $(cat result.txt)\n"
echo RESULT=$(cat result.txt) >> $GITHUB_ENV
echo STATUS="NoChange" >> $GITHUB_ENV
else
echo "Failed to create PR: $(cat result.txt)"
echo RESULT=$(cat result.txt) >> $GITHUB_ENV
echo STATUS="Failed" >> $GITHUB_ENV
fi
echo "WAS IT EXECUTED?"
fi
- name: Send slack notification
if: steps.sync_fork.outcome == 'failure'
run: |
[ "x$STATUS" == "xSynced" ] && \
echo "No need to create PR: $RESULT" && exit 0
[ "x$STATUS" == "xNoChange" ] && \
echo "No need to create PR: $RESULT" && exit 0
([ "x$STATUS" == "xSynced" ] || [ "x$STATUS" == "xNoChange" ]) && \
echo "No need to create PR: $RESULT ${{ steps.create_pr.outcome }}" && exit 0
[ "x$STATUS" == "xCreated" ] && \
FORK_STATUS="⚠️ Changes was not synced with Farajaland repo due to merge conflicts, please merge PR $RESULT manually to keep Farajaland in sync Countryconfig"
[ "x$STATUS" == "xFailed" ] && \
Expand Down

0 comments on commit db8620b

Please sign in to comment.