build-review-badges #2126
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
name: "build-review-badges" | |
on: | |
push: | |
branches: main | |
schedule: | |
- cron: '50 */12 * * *' | |
workflow_dispatch: | |
inputs: | |
name: | |
description: 'Who triggered this build?' | |
required: true | |
default: 'scheduled build' | |
jobs: | |
build-review-badges: | |
if: github.repository_owner == 'carpentries-lab' | |
runs-on: "ubuntu-latest" | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: local::. | |
- name: Generate review labels | |
run: | | |
library(clbadges) | |
validate_review_labels() | |
list_issues <- extract_review_issues() | |
generate_review_badges(list_issues) | |
shell: Rscript {0} | |
- name: Checkout github pages | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: actions/checkout@v2 | |
with: | |
ref: gh-pages | |
path: gh-pages | |
- name: Commit and Push to gh-pages | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
## copy _badges into gh-pages | |
cp _badges/*.svg gh-pages/ | |
## commit gh-pages | |
cd gh-pages | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git add -A *.svg | |
git commit --allow-empty -m "[Github Actions] render review badges (via ${{ github.sha }})" | |
git push origin gh-pages | |
# return | |
cd .. |