forked from AlexsLemonade/OpenPBTA-analysis
-
Notifications
You must be signed in to change notification settings - Fork 14
137 lines (113 loc) · 4.66 KB
/
count-git-contributions.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
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 "[email protected]"
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 "[email protected]"
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