🐛 fix(ci): correggi URL istanza, token e struttura YAML nei workflow condivisi

- Sostituito URL hardcoded con ${{ gitea.server_url }} (portabilità)
- Sostituito ${{ secrets.GITEA_TOKEN }} con ${{ gitea.token }} (token automatico)
- Aggiunto env SERVER_URL/REPOSITORY per evitare espressioni inline nei curl
- Fix dependency-check: rimosso BODY multi-riga (bug YAML run:|) → printf + /tmp/body.md
- Fix auto-release: changelog su /tmp/changelog.txt (evita collisione workspace)
- Fix branch-cleanup: encoding branch via variabile (sicurezza shell)
This commit is contained in:
LucaZanni
2026-03-26 07:01:34 +01:00
parent e5df154060
commit f1305498c1
3 changed files with 19 additions and 22 deletions
+7 -16
View File
@@ -53,7 +53,9 @@ jobs:
- name: Open issue if problems found
if: steps.audit.outputs.vulnerabilities != '0' || steps.outdated.outputs.count != '0'
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GITEA_TOKEN: ${{ gitea.token }}
SERVER_URL: ${{ gitea.server_url }}
REPOSITORY: ${{ gitea.repository }}
run: |
VULNS="${{ steps.audit.outputs.vulnerabilities }}"
OUTDATED="${{ steps.outdated.outputs.count }}"
@@ -62,25 +64,14 @@ jobs:
VULN_LIST=$(jq -r '.vulnerabilities | to_entries[] | "- \(.key): \(.value.severity)"' audit.json 2>/dev/null | head -20 || echo "N/A")
OUTDATED_LIST=$(jq -r 'to_entries[] | "- \(.key): \(.value.current) → \(.value.latest)"' outdated.json 2>/dev/null | head -20 || echo "N/A")
BODY="## Dependency Check — $DATE
### Vulnerabilità (high/critical): $VULNS
\`\`\`
$VULN_LIST
\`\`\`
### Pacchetti obsoleti: $OUTDATED
\`\`\`
$OUTDATED_LIST
\`\`\`"
printf '## Dependency Check — %s\n\n### Vulnerabilità (high/critical): %s\n\n```\n%s\n```\n\n### Pacchetti obsoleti: %s\n\n```\n%s\n```\n' \
"$DATE" "$VULNS" "$VULN_LIST" "$OUTDATED" "$OUTDATED_LIST" > /tmp/body.md
curl -s -X POST \
-H "Content-Type: application/json" \
-H "Authorization: token $GITEA_TOKEN" \
"https://gitea.pzetatouch.it/api/v1/repos/${{ gitea.repository }}/issues" \
"$SERVER_URL/api/v1/repos/$REPOSITORY/issues" \
-d "{
\"title\": \"[$DATE] Dipendenze: $VULNS vulnerabilità, $OUTDATED obsoleti\",
\"body\": $(echo "$BODY" | jq -Rs .)
\"body\": $(jq -Rs . /tmp/body.md)
}"