@@ -16,21 +16,29 @@ jobs:
1616 - name : Checkout Code
1717 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1818
19- # Step 1: Clone the Devportal Repository
19+ # Step 1: Generate GitHub App Token
20+ - name : Generate GitHub App Token
21+ id : generate_token
22+ uses : actions/create-github-app-token@31c86eb3b33c9b601a1f60f98dcbfd1d70f379b4 # v1.10.3
23+ with :
24+ app-id : ${{ secrets.GH_APP_ID }}
25+ private-key : ${{ secrets.GH_APP_PRIVATE_KEY }}
26+ owner : rsksmart
27+ repositories : devportal
28+
29+ # Step 2: Clone the Devportal Repository
2030 - name : Clone Devportal Repository
21- env :
22- GITHUB_TOKEN : ${{ secrets.DEVPORTAL_DOCS_UPDATE_TOKEN }}
2331 run : |
2432 TIMESTAMP=$(date +'%Y%m%d-%H%M%S')
2533 BRANCH_NAME="update-from-lps-${TIMESTAMP}"
2634 echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV
2735
28- git clone https://github.com/rsksmart/devportal.git
36+ git clone https://x-access-token:${{ steps.generate_token.outputs.token }}@ github.com/rsksmart/devportal.git
2937 cd devportal
3038 git checkout -b ${BRANCH_NAME} || git checkout ${BRANCH_NAME}
3139 cd ..
3240
33- # Step 2 : Transform Each File and Copy to Devportal Repository
41+ # Step 3 : Transform Each File and Copy to Devportal Repository
3442 - name : Transform Files for Devportal
3543 run : |
3644 set -e
@@ -232,27 +240,23 @@ jobs:
232240 rm ${TEMP_FILE}
233241 cp ${TRANSFORMED_FILE} ${BASE_DST}/trusted-accounts.md
234242
235- # Step 3 : Commit and Push Changes to Devportal Repository
243+ # Step 4 : Commit and Push Changes to Devportal Repository
236244 - name : Commit and Push Changes
237- env :
238- GITHUB_TOKEN : ${{ secrets.DEVPORTAL_DOCS_UPDATE_TOKEN }}
239245 run : |
240246 cd devportal
241247 git config user.name "github-actions[bot]"
242248 git config user.email "github-actions[bot]@users.noreply.github.com"
243249 git add docs/02-developers/06-integrate/02-flyover/
244250 git commit -m "Automated update from Liquidity Provider Server repository"
245- git remote set-url origin https://x-access-token:${GITHUB_TOKEN }@github.com/rsksmart/devportal.git
251+ git remote set-url origin https://x-access-token:${{ steps.generate_token.outputs.token } }@github.com/rsksmart/devportal.git
246252 git push -f origin ${BRANCH_NAME}
247253
248- # Step 4 : Create a Pull Request in the Devportal Repository
254+ # Step 5 : Create a Pull Request in the Devportal Repository
249255 - name : Create Pull Request
250- env :
251- GITHUB_TOKEN : ${{ secrets.DEVPORTAL_DOCS_UPDATE_TOKEN }}
252256 run : |
253257 cd devportal
254258 curl -L -X POST -H "Accept: application/vnd.github+json" \
255- -H "Authorization: Bearer ${{ secrets.DEVPORTAL_DOCS_UPDATE_TOKEN }}" \
259+ -H "Authorization: Bearer ${{ steps.generate_token.outputs.token }}" \
256260 -H "X-GitHub-Api-Version: 2022-11-28" \
257261 https://api.github.com/repos/rsksmart/devportal/pulls \
258262 -d "{\"title\":\"Liquidity-provider-server automated update of documentation ${BRANCH_NAME}\",\"body\":\"This PR updates the Devportal documentation with the latest changes from the Liquidity Provider Server repository.\",\"head\":\"${BRANCH_NAME}\",\"base\":\"main\"}"
0 commit comments