Writes a GitHub Actions workflow, .github/workflows/rghcard.yml, into your profile
repository: the repository named after your user name, whose README GitHub shows on your
profile. Every week, and whenever you run it from the Actions tab, the workflow runs the
rghcard GitHub Action, sedzinfo/rghcard@v0, which collects your statistics with
collect_stats(), draws the cards with contributions_card(), stats_card(),
activity_card(), visitors_card(), actions_card() and code_card(), and commits them,
with the history in rghcard-data/, to the repository.
Arguments
- path
The profile repository on your computer.
- themes
The themes to draw the cards in:
"dark","light"or both, asrghcard-<card>-dark.svgandrghcard-<card>-light.svg, such asrghcard-stats-dark.svg.- cards
The cards to draw:
"contributions","stats","activity","visitors","actions"or"code", whichcontributions_card(),stats_card()and the other card functions draw. By default all six, and your README shows those you choose.- format
"svg","png"or both: the format of the cards. A README shows an SVG card sharp on any screen, in the fonts of GitHub's own pages.- schedule
When to run, as a cron schedule in UTC: by default every Monday at 05:17. Run it at least once a week, since GitHub keeps the traffic for 14 days.
- overwrite
Replace a workflow written before?
Details
The workflow needs a token that can read the traffic of your repositories, as the repository
secret RGHCARD_TOKEN; the steps are printed when the workflow is written, with the code that
shows the cards in your README. Without it, the cards show the public statistics only. When
the token expires or is revoked, the workflow fails with a message saying so: put a new token
in the secret.
The action installs R and rghcard on GitHub's machine, so the workflow needs no R of yours.
@v0 is the latest release of rghcard 0.x, so a change to the package reaches the cards when
it is released, not while it is being made. The
README of the package lists the inputs of the
action, which the with of the workflow can set: the charts and the days of the cards, for
example.
The cards and the history are public in a public profile repository. Private repositories are left out of both.
See also
collect_stats() collects the statistics, as the action does, and
contributions_card(), stats_card(), activity_card(), visitors_card(),
actions_card() and code_card() draw the cards in R.
Examples
profile <- tempfile()
use_rghcard_action(profile, themes = "dark", cards = c("contributions", "stats"))
#> Wrote /tmp/RtmpQs5xEH/file1d77782e3d06/.github/workflows/rghcard.yml. Next:
#> 1. Create a token with this link, which fills in GitHub's form: the name rghcard, the
#> permission Administration: Read-only (the traffic) and Expiration: none (when the token
#> expires, the cards stop updating). GitHub adds Metadata: Read-only by itself.
#> https://github.com/settings/personal-access-tokens/new?name=rghcard&description=Reads+the+traffic+of+my+repositories+for+the+rghcard+cards&expires_in=none&administration=read
#> Choose Repository access: All repositories, click Generate token and copy the token:
#> GitHub shows it only once.
#> 2. Add it to the profile repository: Settings > Secrets and variables > Actions >
#> New repository secret, named RGHCARD_TOKEN.
#> 3. Commit and push the workflow, then run it once: Actions > rghcard > Run workflow.
#> 4. Show the cards in README.md, all of them or those you choose:
#>
#> <img alt="GitHub contributions" src="rghcard-contributions-dark.svg" width="100%"/>
#> <img alt="GitHub statistics" src="rghcard-stats-dark.svg" width="100%"/>