Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ptonso authored Oct 16, 2024
0 parents commit ad22571
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Descrição

Descreva sua alteração no repositório (opcional)

## Tipo de Mudança

Selecione as opções aplicáveis

- [ ] Novo Diretório (Adicionando nova atividade)
- [ ] Minha atividade (Compartilhando meu código)
- [ ] Alterações no Repositório

## Checklist:

- [ ] Meu código está funcional
- [ ] Aceito que outras pessoas consumam meu código
- [ ] Não é plágio e, caso aplicável, citei as referências
40 changes: 40 additions & 0 deletions .github/workflows/new-activity-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Ensuring that every time a new directory is added to the repository,
# the README.md file in the root is updated with a reference to its content.

name: Validate README.md Update

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
check-readme:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3

- name: Set up Git
run: git fetch --all

- name: Identify new directories
id: new_dirs
run: |
new_dirs=$(git diff --name-status origin/main | awk '$1 == "A" && $2 ~ /\/$/ {print $2}')
echo "New directories added: $new_dirs"
echo "::set-output name=new_dirs::$new_dirs"
- name: Check if README.md was modified
if: steps.new_dirs.outputs.new_dirs != ''
run: |
readme_changed=$(git diff --name-only origin/main | grep -c "README.md" || true)
if [ $readme_changed -eq 0 ]; then
echo "README.md was not updated. Please update it to reflect new directories."
exit 1
else
echo "README.md was updated."
fi
44 changes: 44 additions & 0 deletions .github/workflows/structure-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Validate Repository Structure

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
validate-structure:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Validate Repository Structure
run: |
# Ensure the main README.md exists
if [ ! -f "README.md" ]; then
echo "Root README.md is missing. Please add a README.md with discipline name and code."
exit 1
fi
# Ensure each task folder has a README.md and no unauthorized files
for dir in */ ; do
if [ ! -f "${dir}/README.md" ]; then
echo "Task ${dir} is missing a README.md. Each task folder must have a README.md file with the task description."
exit 1
fi
# Check that every file in the task folder follows the author naming convention
for file in "${dir}"*; do
filename=$(basename "$file")
if [[ "$filename" != *"."* ]]; then
echo "File ${filename} in ${dir} does not follow the naming convention. It should be named as 'author.extension'."
exit 1
fi
done
done
echo "Repository structure is valid."
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# [Discipline Code]
[Discipline name]

# Pastas por tópicos:

## Tópico 1
- [Task 1](./task1)
- [Task 2](./task2)
16 changes: 16 additions & 0 deletions pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.1
hooks:
- id: no-commit-to-branch
args: ['--pattern', '^(?!((new_dir|new_ex|bugfix)\/[a-zA-Z0-9\-]+)$).*']

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml
- id: check-json
- id: check-merge-conflict
- id: check-toml
5 changes: 5 additions & 0 deletions task1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Descrição da tarefa

Adicione o enunciado ou descrição desta tarefa

Sua solução deve respeitar o formato `seu_nome.extensao`.
Empty file added task1/example_author.py
Empty file.
Empty file added task2/README.md
Empty file.
Empty file added task2/example_author.py
Empty file.

0 comments on commit ad22571

Please sign in to comment.