Skip to content

Commit

Permalink
Merge pull request #261 from codaqui/fix/fixing-errors-and-turn-on-pr…
Browse files Browse the repository at this point in the history
…oject

Corrigindo Problemas e Deixando o Projeto Ligado
  • Loading branch information
endersonmenezes authored Oct 25, 2023
2 parents 00556d9 + af63e22 commit d838486
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/boletim-diario.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: |
echo "Iniciando Boletim"
# Boletim Diario De Segurança
# Atualização e a Instalação de Dependência
echo "Atualizando Dependências"
sudo apt-get update -y
sudo apt -y install libxml2-utils
# Comandos Para Criar uma Nova Issue
echo "Executando script's"
chmod +X ./script.sh
bash ./script.sh
echo "SCRIPT_DATA=$(date +'%d/%m/%Y')" >> $GITHUB_ENV
Expand All @@ -34,12 +34,16 @@ jobs:
echo 'EOF' >> $GITHUB_ENV
# Comandos Para Fechar Issue Aberta
echo "Fechando Issue aberta"
chmod +X ./number.sh
bash ./number.sh
var=$( cat numero_final.txt )
gh issue close $var
var=$(cat numero_final.txt)
# If var is "pr" ignore issue close
if [ "$var" = "pr" ]; then
echo "Issue não será fechada"
else
gh issue close $var
fi
- uses: JasonEtco/create-an-issue@v2
id: create-issue
Expand Down
15 changes: 14 additions & 1 deletion number.sh
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
curl 'https://api.github.com/repos/codaqui/boletim-diario-seguranca/issues' | jq -r '.[0].number' >> numero_final.txt
# Verify the last issue number
curl 'https://api.github.com/repos/codaqui/boletim-diario-seguranca/issues' > response.json

# How many issues are open?
ISSUES_OPEN=$(cat response.json | jq '. | length')

# Get the last issue number is not a Pull Request
ISSUE_NUMBER=$(cat response.json | jq -r '.[] | select(.pull_request == null) | .number' | head -n 1)
if [ -z "$ISSUE_NUMBER" ]
then
echo "pr" > numero_final.txt
else
echo $ISSUE_NUMBER > numero_final.txt
fi

0 comments on commit d838486

Please sign in to comment.