From 50e32f03a578cc587febf3454940d881336918fd Mon Sep 17 00:00:00 2001 From: Dennis Terhorst Date: Thu, 15 Feb 2024 17:35:48 +0100 Subject: [PATCH 1/2] add workflow to periodically check for outdated links in description --- .github/workflows/check-for-updates.yml | 33 +++++++++++++++++++++++++ _codes/nest.md | 1 + 2 files changed, 34 insertions(+) create mode 100644 .github/workflows/check-for-updates.yml diff --git a/.github/workflows/check-for-updates.yml b/.github/workflows/check-for-updates.yml new file mode 100644 index 0000000..828d17c --- /dev/null +++ b/.github/workflows/check-for-updates.yml @@ -0,0 +1,33 @@ + +on: + schedule: + - cron: '30 12 * * 3' # every Wednesday at 12:30 + workflow_dispatch: {} # when manually started via "Actions" tab. + +jobs: + check_code_versions: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + tool: [4c, fleur, heat, nest, pffrg] + steps: + + - name: "Checkout repository content" + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + + - name: "Fetch latest repository versions" + run: | + DESCRIPTION="_codes/${{ matrix.tool }}.md" + echo "Scanning $DESCRIPTION..." + grep 'Repository: .*github.com/' $DESCRIPTION # check if repository is on github (required for API calls) + REPO="$(grep -o 'Repository: .*github.com/([^ ]+)' $DESCRIPTION)" + echo "Checking repository $REPO on GitHub..." + RELEASE="$(curl -sL https://api.github.com/repos/nest/nest-simulator/releases/latest | jq ".tag_name")" + echo "Found latest release: $RELEASE" + DOI="https://$(curl -sL https://api.github.com/repos/nest/nest-simulator/releases/latest | jq ".body" | grep -o 'doi.org/[^)]*zenodo[^)]\+' | head -n1)" + echo "Found latest DOI: $DOI" + grep $RELEASE $DESCRIPTION # check latest release is mentioned + grep $DOI $DESCRIPTION # check latest DOI is mentioned diff --git a/_codes/nest.md b/_codes/nest.md index e293eff..7c37b60 100644 --- a/_codes/nest.md +++ b/_codes/nest.md @@ -9,6 +9,7 @@ Members: https://github.com/orgs/nest/people and https://nest-initiative.org Research Field: Helmholtz Information Scientific Community: Biology, Medicine, AI Funding: See https://github.com/nest/nest-simulator/blob/master/ACKNOWLEDGMENTS.md +Repository: https://github.com/nest/nest-simulator Programming Languages: C++, Python License: GPL-2.0-or-later Cite: DOI From 4be9617d56b5e51c9ef8dd407aa74e02d9052bc9 Mon Sep 17 00:00:00 2001 From: Dennis Terhorst Date: Thu, 15 Feb 2024 17:51:56 +0100 Subject: [PATCH 2/2] fix repo-name extraction --- .github/workflows/check-for-updates.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-for-updates.yml b/.github/workflows/check-for-updates.yml index 828d17c..e784b0e 100644 --- a/.github/workflows/check-for-updates.yml +++ b/.github/workflows/check-for-updates.yml @@ -23,11 +23,11 @@ jobs: DESCRIPTION="_codes/${{ matrix.tool }}.md" echo "Scanning $DESCRIPTION..." grep 'Repository: .*github.com/' $DESCRIPTION # check if repository is on github (required for API calls) - REPO="$(grep -o 'Repository: .*github.com/([^ ]+)' $DESCRIPTION)" + REPO="$(grep 'Repository:' $DESCRIPTION | sed -e 's%Repository.*https://github.com/%%')" echo "Checking repository $REPO on GitHub..." - RELEASE="$(curl -sL https://api.github.com/repos/nest/nest-simulator/releases/latest | jq ".tag_name")" + RELEASE="$(curl -sL https://api.github.com/repos/$REPO/releases/latest | jq ".tag_name")" echo "Found latest release: $RELEASE" - DOI="https://$(curl -sL https://api.github.com/repos/nest/nest-simulator/releases/latest | jq ".body" | grep -o 'doi.org/[^)]*zenodo[^)]\+' | head -n1)" + DOI="https://$(curl -sL https://api.github.com/repos/$REPO/releases/latest | jq ".body" | grep -o 'doi.org/[^)]*zenodo[^)]\+' | head -n1)" echo "Found latest DOI: $DOI" grep $RELEASE $DESCRIPTION # check latest release is mentioned grep $DOI $DESCRIPTION # check latest DOI is mentioned