Merge pull request #5 from rsksmart/docs/update-readme #5
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
name: Update Devportal Documentation | |
on: | |
push: | |
paths: | |
- 'README.md' | |
branches: | |
- main | |
jobs: | |
update-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
# Step 1: Clone the Devportal Repository | |
- name: Clone Devportal Repository | |
env: | |
GITHUB_TOKEN: ${{ secrets.DEVPORTAL_DOCS_UPDATE_TOKEN }} | |
run: | | |
git clone https://github.com/rsksmart/devportal.git | |
cd devportal | |
git checkout -b update-from-foundry-starter || git checkout update-from-foundry-starter | |
cd .. | |
# Step 2: Transform Each File and Copy to Devportal Repository | |
- name: Transform Files for Devportal | |
run: | | |
mkdir -p transformed | |
# Process README.md | |
echo "---" > transformed/README.md | |
echo "sidebar_label: Foundry" >> transformed/README.md | |
echo "sidebar_position: 500" >> transformed/README.md | |
echo "title: Rootstock Foundry Starter kit" >> transformed/README.md | |
echo "description: 'Whether you are a seasoned developer or just starting your journey into smart contract development, the foundry starter kit provides a solid foundation for building decentralized applications (dApps) on the Rootstock network.'" >> transformed/README.md | |
echo "tags: [rsk, rootstock, tutorials, developers, foundry, quick starts, dApps, smart contracts]" >> transformed/README.md | |
echo "---" >> transformed/README.md | |
echo "" >> transformed/README.md | |
echo ":::info[Note]" >> transformed/README.md | |
echo "If you wish to suggest changes on this document, please open a PR on the [Foundry Starter Kit Repository](https://github.com/rsksmart/rootstock-foundry-starterkit.git)" >> transformed/README.md | |
echo ":::" >> transformed/README.md | |
echo "" >> transformed/README.md | |
cat README.md >> transformed/README.md | |
cp transformed/README.md devportal/docs/02-developers/04-quickstart/foundry.md | |
# Step 3: Commit and Push Changes to Devportal Repository | |
- name: Commit and Push Changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.DEVPORTAL_DOCS_UPDATE_TOKEN }} | |
run: | | |
cd devportal | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add docs/02-developers/04-quickstart/foundry.md | |
git commit -m "Automated update from repository" | |
# Configure the remote URL with the token for authentication | |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/rsksmart/devportal.git | |
git push -f origin update-from-foundry-starter | |
# Step 4: Create a Pull Request in the Devportal Repository | |
- name: Create Pull Request | |
env: | |
GITHUB_TOKEN: ${{ secrets.DEVPORTAL_DOCS_UPDATE_TOKEN }} | |
run: | | |
cd devportal | |
curl -L -X POST -H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.DEVPORTAL_DOCS_UPDATE_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/rsksmart/devportal/pulls \ | |
-d '{"title":"Automated update of documentation","body":"This PR updates the Devportal documentation with the latest changes from the original repository.","head":"update-from-foundry-starter","base":"main"}' |