159 capitalization in paper references #308
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow triggered when we have a new release candidate | |
# This action is adapted from https://github.com/t4d-gmbh/stubbed_versioning | |
name: On Label Linting and extra checks | |
on: | |
pull_request: | |
types: [ labeled ] | |
env: | |
LINT_LABEL_CHECK: 'linting::check' | |
LINT_LABEL_SUCCESS: 'linting::passed' | |
LINT_LABEL_FAILURE: 'linting::failed' | |
URL_LABEL_CHECK: 'URL::check' | |
URL_LABEL_SUCCESS: 'URL::passed' | |
URL_LABEL_FAILURE: 'URL::failed' | |
BUILD_LOC: "./build" | |
permissions: | |
packages: read | |
contents: write | |
pull-requests: write | |
repository-projects: write | |
jobs: | |
set_target: | |
# NOTE: Would be nice to not copy it here, however, since env is not accessible | |
# we would need a prev. job to set it up, which will succeed, leading the | |
# workflow to be shown as succeeded not skipped | |
if: ${{ ( github.event.label.name == 'linting::check' ) || ( github.event.label.name == 'URL::check' ) }} | |
runs-on: ubuntu-latest | |
outputs: | |
lint_label: ${{ steps.set_label.outputs.lint_label }} | |
url_label: ${{ steps.set_label.outputs.url_label }} | |
steps: | |
- id: set_label | |
run: | | |
echo "lint_label=${{ env.LINT_LABEL_CHECK }}" >> "$GITHUB_OUTPUT" | |
echo "url_label=${{ env.URL_LABEL_CHECK }}" >> "$GITHUB_OUTPUT" | |
check_label_exist: | |
needs: | |
- set_target | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
OWNER: ${{ github.repository_owner }} | |
REPO: ${{ github.event.repository.name }} | |
permissions: | |
pull-requests: write | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
# NOTE: would be nicer to not re-define them here, however env is not | |
# evaluated > would need to go thour the output of a previous job | |
label: | |
- 'linting::check' | |
- 'linting::passed' | |
- 'linting::failed' | |
- 'URL::check' | |
- 'URL::passed' | |
- 'URL::failed' | |
steps: | |
- name: Assert labels ${{ matrix.label }} is defined | |
run: | | |
gh label create ${{ matrix.label }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
continue-on-error: true # make sure the next steps run also on failure | |
lint_project: | |
if: ${{ ( github.event.label.name == needs.set_target.outputs.lint_label ) }} | |
needs: | |
- set_target | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- name: Install lintr | |
run: install.packages("lintr") | |
shell: Rscript {0} | |
- name: Lint root directory | |
run: lintr::lint_dir(linters=lintr::with_defaults(line_length_linter=NULL, infix_spaces_linter=NULL, trailing_whitespace_linter=NULL)) | |
shell: Rscript {0} | |
env: | |
LINTR_ERROR_ON_LINT: true | |
report_lint: | |
if: ${{ ( success() || failure() ) }} | |
needs: | |
- lint_project | |
- check_label_exist | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
repository-projects: write | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
OWNER: ${{ github.repository_owner }} | |
REPO: ${{ github.event.repository.name }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Report the linting status by label | |
run: | | |
gh pr edit ${{ env.EVENT }} --remove-label ${{ env.LINT_LABEL_CHECK }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
if [ ${{ needs.lint_project.result }} == "success" ]; then | |
gh pr edit ${{ env.EVENT }} --remove-label ${{ env.LINT_LABEL_FAILURE }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
gh pr edit ${{ env.EVENT }} --add-label ${{ env.LINT_LABEL_SUCCESS }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
echo "### ${{ github.event.label.url }} passed! :rocket:" >> $GITHUB_STEP_SUMMARY | |
exit 0 | |
elif [ ${{ needs.lint_project.result }} == "failure" ]; then | |
gh pr edit ${{ env.EVENT }} --remove-label ${{ env.LINT_LABEL_SUCCESS }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
gh pr edit ${{ env.EVENT }} --add-label ${{ env.LINT_LABEL_FAILURE }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
echo "### ${{ github.event.label.url }} failed!" >> $GITHUB_STEP_SUMMARY | |
exit 1 | |
else | |
gh pr edit ${{ env.EVENT }} --add-label ${{ env.LINT_LABEL_CHECK }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
echo "On demand task outcome was ${{ needs.lint_project.outcome }}" | |
fi | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
EVENT: ${{ github.event.number }} # This is either the issue or pr | |
URL_check: | |
runs-on: ubuntu-latest | |
if: ${{ (github.event.label.name == needs.set_target.outputs.url_label ) }} | |
needs: | |
- set_target | |
name: Run URL checks | |
# runs-on: ubuntu-latest | |
container: | |
image: ${{ vars.CONTAINER_SOURCE }}/${{ vars.CONTAINER_RELEASE || 'debian/gcc/release' }}/abn:${{ vars.CONTAINER_VERSION || 'latest' }} | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Disable renv | |
run: | | |
renv::deactivate() | |
shell: Rscript {0} | |
- name: Check for broken urls and redirects | |
run: | | |
library(urlchecker) | |
uc=url_check("./") | |
print(uc) | |
# uc=url_check("./");print(uc);print(uc$Status); if(any(uc$Status=="Error") || any(uc$Status=="403")) {q("no", status=1, FALSE)} | |
shell: Rscript {0} | |
report_URL_check: | |
needs: | |
- URL_check | |
- check_label_exist | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
repository-projects: write | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
OWNER: ${{ github.repository_owner }} | |
REPO: ${{ github.event.repository.name }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check if on demand tasks succeeded | |
#TODO: Properly establish what has failead and what not | |
run: | | |
gh pr edit ${{ env.EVENT }} --remove-label ${{ env.URL_LABEL_CHECK }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
if [ ${{ needs.URL_check.result }} == "success" ]; then | |
gh pr edit ${{ env.EVENT }} --remove-label ${{ env.URL_LABEL_FAILURE }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
gh pr edit ${{ env.EVENT }} --add-label ${{ env.URL_LABEL_SUCCESS }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
echo "### ${{ github.event.label.url }} passed! :rocket:" >> $GITHUB_STEP_SUMMARY | |
exit 0 | |
elif [ ${{ needs.URL_check.result }} == "failure" ]; then | |
gh pr edit ${{ env.EVENT }} --remove-label ${{ env.URL_LABEL_SUCCESS }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
gh pr edit ${{ env.EVENT }} --add-label ${{ env.URL_LABEL_FAILURE }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
echo "### ${{ github.event.label.url }} failed!" >> $GITHUB_STEP_SUMMARY | |
exit 1 | |
else | |
gh pr edit ${{ env.EVENT }} --add-label ${{ env.URL_LABEL_CHECK }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
echo "On demand task outcome was ${{ needs.URL_check.outcome }}" | |
fi | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
EVENT: ${{ github.event.number }} # This is either the issue or pr | |
record_passed_label: | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
OWNER: ${{ github.repository_owner }} | |
REPO: ${{ github.event.repository.name }} | |
permissions: | |
contents: write | |
pull-requests: write | |
repository-projects: write | |
outputs: | |
passed: ${{ steps.passed.outputs.PASSED}} | |
steps: | |
- name: Check if the pull request is labeled with ${{ env.URL_LABEL_SUCCESS }} # 2 | |
id: passed | |
run: | | |
if $( gh pr view ${{ env.EVENT }} --repo ${{ env.OWNER }}/${{ env.REPO }} --json "labels" --jq ".[].[].name" | grep --quiet ${{ env.URL_LABEL_SUCCESS }}); then | |
echo "PASSED=true" >> $GITHUB_OUTPUT | |
else | |
echo "PASSED=false" >> $GITHUB_OUTPUT | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
EVENT: ${{ github.event.number }} # This is either the issue or pr | |
URL_passed: | |
if: ${{ always() }} | |
needs: | |
- URL_check | |
- record_passed_label | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
OWNER: ${{ github.repository_owner }} | |
REPO: ${{ github.event.repository.name }} | |
steps: | |
- name: Assert that either checks passed on the label is present | |
run: | | |
if [[ ${{ needs.URL_check.result }} == 'success' || ${{ needs.record_passed_label.outputs.passed }} == 'true' ]]; then | |
echo 'URL status ok'; | |
else exit 1; fi | |
# NOTE: Currently for the linting there is not check that passes if the label linting::passed is present |