cronjob for counting git contributions and filing a PR with results #13
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: cronjob for counting git contributions and filing a PR with results | |
# Run every Monday at 8:00 UTC | |
# On Monday, we count git contributions | |
# But we can also manually trigger this | |
on: | |
schedule: | |
- cron: "0 14 * * MON" | |
workflow_dispatch: | |
permissions: | |
pull-requests: write | |
jobs: | |
file-count-contributions-pr: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
container: | |
image: rocker/tidyverse:4.4 | |
# We want to count the contributions to the dev branch | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: "dev" | |
fetch-depth: 0 | |
- name: Configure git | |
run: | | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
git config --local user.email "actions@github.com" | |
git config --local user.name "GitHub Actions" | |
# We need this package for one of the notebooks run via the shell script below | |
- name: Install yaml R package | |
run: Rscript -e "install.packages('yaml')" | |
# Rerun the module we want new results for | |
- name: Rerun count-contributions module | |
run: | | |
bash analyses/count-contributions/run-count-contributions.sh | |
# Upload the manuscript YAML as an artifact | |
- name: Upload metadata YAML artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: manuscript_metadata | |
path: analyses/count-contributions/results/metadata.yaml | |
# Upload the author information as an artifact | |
- name: Upload author information TSV artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: author_information | |
path: analyses/count-contributions/author_information.tsv | |
# Create a pull request with the updated results | |
- name: Create PR with updated contribution module | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
commit-message: Rerun count-contributions analysis module | |
signoff: false | |
branch: auto_count_contributions | |
delete-branch: true | |
title: 'GHA: Updated git contribution stats' | |
body: | | |
### Description | |
This PR auto-generated from GitHub Actions rerunning `analyses/count-contributions` | |
### Instruction for reviewers | |
Review the updates in `analyses/count-contributions/results/` for accuracy | |
reviewers: $GITHUB_ACTOR | |
file-metadata-yaml-pr: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
needs: file-count-contributions-pr | |
# We want to add the updated metadata to the manuscript repo | |
steps: | |
- name: Checkout manuscript repository | |
uses: actions/checkout@v4 | |
with: | |
repository: d3b-center/OpenPedCan-manuscript | |
- name: Configure git | |
run: | | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
git config --local user.email "actions@github.com" | |
git config --local user.name "GitHub Actions" | |
# Set up directories to be able to receive artifacts | |
# Note, You can not overwrite an existing file with an artifact, | |
# so this step also removes existing files. | |
- name: Directory setup | |
run: | | |
mkdir -p submission_info/ | |
rm -f submission_info/author_information.tsv | |
rm content/metadata.yaml | |
- name: Download the metadata artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: manuscript_metadata | |
path: content | |
- name: Download the author information artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: author_information | |
path: submission_info | |
# Create a pull request with the updated results | |
- name: Create PR with updated manuscript metadata YAML | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
commit-message: Update manuscript metadata | |
signoff: false | |
branch: auto_author_order | |
delete-branch: true | |
title: 'GHA: Updated author order' | |
body: | | |
### Description | |
This PR auto-generated from GitHub Actions workflow that counts git contributions and sets author order accordingly in the `AlexsLemonade/OpenPBTA-analysis` repo. | |
See [the relevant module](https://github.com/d3b-center/OpenPedCan-analysis/tree/dev/analyses/count-contributions) for more info. | |
### Instruction for reviewers | |
Review the updates in `content/metadata.yaml` and `submission_info/author_information.tsv` for accuracy. | |
reviewers: $GITHUB_ACTOR |