-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Controllo automatico dei link rotti #24
base: master
Are you sure you want to change the base?
Controllo automatico dei link rotti #24
Conversation
Ho aggiunto un nuovo workflow di GitHub Actions chiamato 'Check README Links' per verificare i link nel file README.md del progetto.
test per branch
… progetto. Se trova link rotti, apre automaticamente una nuova issue nel repository segnalando i dettagli del link rotto. L'issue include il link rotto nel titolo e nel corpo.
…tti' into Controllo_automatico_dei_link_rotti
…tti' into Controllo_automatico_dei_link_rotti
…tti' into Controllo_automatico_dei_link_rotti
…tti' into Controllo_automatico_dei_link_rotti
…tti' into Controllo_automatico_dei_link_rotti
…tti' into Controllo_automatico_dei_link_rotti
…tti' into Controllo_automatico_dei_link_rotti
…tti' into Controllo_automatico_dei_link_rotti
…tti' into Controllo_automatico_dei_link_rotti
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @saver999, thank you for the PR! 🚀
- name: Get links from README.md | ||
id: get-links | ||
run: | | ||
LINKS=$(grep -oP '\[.*?\]\((http[s]?://[^)]*)\)' README.md | sed -E 's/\[.*\]\(([^)]+)\)/\1/' | paste -sd "," -) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LINKS=$(grep -oP '\[.*?\]\((http[s]?://[^)]*)\)' README.md | sed -E 's/\[.*\]\(([^)]+)\)/\1/' | paste -sd "," -) | |
LINKS=$(grep -oP '\[.*?\]\((http[s]?://[^)]*)\)' README.md | sed -E 's/\[.*\]\(([^)]+)\)/\1/' | paste -sd ,) |
Can't we use just sed
here?
|
||
# Scansiona i link e verifica se sono raggiungibili | ||
for link in "${LINKS[@]}"; do | ||
if [[ $link =~ ^(http|https):// ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this guaranteed by the regexps populating $LINKS
?
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
filename: ${{ env.ISSUE_TEMPLATE }} | ||
if: failure() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will run when the link checker job is successful, in case actions/checkout
fails.
- uses: actions/checkout@v3 | ||
if: failure() | ||
|
||
- uses: JasonEtco/create-an-issue@v2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this action create a new issue everytime? Because if thats the case, we want to create a new issue if there's no issue opened yet, but update the issue if there is already one.
- uses: actions/checkout@v3 | ||
if: failure() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do this because we need a single file (.github/workflows/ISSUE_TEMPLATE.md
) and doing so we get the whole history and the rest of the repo. Not a big deal, but maybe we can optimize that, also considering it interferes with the if: failure()
logic (see below).
Co-authored-by: Fabio Bonelli <[email protected]>
Co-authored-by: Fabio Bonelli <[email protected]>
…tti' into Controllo_automatico_dei_link_rotti # Conflicts: # .github/workflows/ISSUE_TEMPLATE.md
Il mio script utilizza GitHub Actions per eseguire il controllo dei link rotti nel file README.md. Il workflow scansiona (ogniqualvolta si esegue un push sul branch master ed ogni primo del mese a mezzanotte) tutti i link nel file e verifica se sono raggiungibili. Se un link non è raggiungibile, il workflow apre un'issue nel repository principale per segnalare il link rotto. #20