Update README #340
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 README | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- README.md | |
schedule: | |
- cron: '0 */6 * * *' | |
jobs: | |
update-readme: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.PAT }} | |
- name: Set up Git | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Pull changes | |
run: git pull origin main --rebase | |
- name: Fetch all branches | |
run: git fetch --all | |
- name: Get list of branches | |
id: get_branches | |
run: | | |
branches=$(git branch -r | grep -v '\->' | grep -v 'main' | awk -F/ '{print $2}' | grep -v 'branch-base') | |
branches=$(echo $branches | tr ' ' '\n' | sort -u | tr '\n' ' ') | |
echo "branches=$branches" >> $GITHUB_ENV | |
echo "::set-output name=branches::$branches" | |
- name: Update README.md | |
run: | | |
git pull origin main # Atualiza sua branch local com as mudanças remotas | |
echo "# Landing Pages Repository" > README.md | |
echo "" >> README.md | |
echo "Bem-vindo ao repositório de Landing Pages! Este repositório foi criado para armazenar todas as landing pages que eu desenvolver como forma de estudo de front-end. Cada landing page estará em uma branch separada, e você encontrará versões diferentes da mesma landing page utilizando tecnologias distintas." >> README.md | |
echo "" >> README.md | |
echo "## Índice de Landing Pages" >> README.md | |
echo "" >> README.md | |
for branch in ${{ steps.get_branches.outputs.branches }}; do | |
echo "- [$branch](https://github.com/Kaduh15/landing-pages/tree/$branch)" >> README.md | |
done | |
echo "" >> README.md | |
echo "## Como Navegar no Repositório" >> README.md | |
echo "" >> README.md | |
echo "1. **Branches:** Cada landing page tem sua própria branch principal. Navegue entre as branches para ver os diferentes projetos." >> README.md | |
echo "2. **Versões:** Dentro de cada branch, você encontrará diferentes versões da landing page, cada uma utilizando uma tecnologia diferente." >> README.md | |
echo "## Contribuições" >> README.md | |
echo "" >> README.md | |
echo "Se você deseja contribuir com este repositório, sinta-se à vontade para criar um pull request. Toda contribuição é bem-vinda!" >> README.md | |
echo "" >> README.md | |
echo "---" >> README.md | |
echo "" >> README.md | |
echo "Happy coding! 😊" >> README.md | |
- name: Commit changes | |
run: | | |
git add README.md | |
git diff-index --quiet HEAD || git commit -m 'Update README.md with branch links' | |
git push origin main # Faz o push das mudanças atualizadas para a branch main | |
- name: Debugging | |
run: | | |
echo "Branches: ${{ steps.get_branches.outputs.branches }}" | |
cat README.md |