mirror of
https://github.com/bcanseco/github-contribution-graph-action.git
synced 2025-10-09 13:41:58 +03:00
fix(env): make git_branch fallback to github_ref
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
GIT_BRANCH=master
|
||||
GIT_HOST=github.com
|
||||
GIT_COMMIT_MESSAGE=chore(actions): empty commit for contribution graph
|
||||
GIT_SSH_COMMAND=ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
|
||||
|
||||
1
.github/CONTRIBUTING.md
vendored
1
.github/CONTRIBUTING.md
vendored
@@ -31,6 +31,7 @@ Thanks for considering a contribution to this project! 🙏
|
||||
* Make sure to check the **Repo** boxes.
|
||||
* Note that the personal access token has more permissions than the `GITHUB_TOKEN` provided by the Actions runner. Read more about this [here](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#permissions-for-the-github_token).
|
||||
* `GIT_EMAIL`: Set this to [an email associated with your GitHub account](https://github.com/settings/emails).
|
||||
* `GIT_BRANCH`: Set this to `master`.
|
||||
1. Make sure your Docker daemon is running.
|
||||
|
||||
### Running 👟
|
||||
|
||||
10
README.md
10
README.md
@@ -45,7 +45,7 @@
|
||||
|
||||
If you change your mind about these commits later, you can delete the repository and they'll disappear from your contribution graph.
|
||||
|
||||
### Push a commit to master once a day 🍺
|
||||
### Push a commit to GitHub once a day 🍺
|
||||
|
||||
```yml
|
||||
# .github/workflows/main.yml
|
||||
@@ -66,16 +66,14 @@ jobs:
|
||||
|
||||
If you need help with cron job syntax, [crontab guru](https://crontab.guru/) is a great resource.
|
||||
|
||||
### Backfill a year of commits whenever you push to master 🍻
|
||||
### Backfill a year of commits whenever you push to GitHub 🍻
|
||||
|
||||
This rolls a pseudorandom number generator between 1 and 5 (inclusive) to determine how many commits to make per-day.
|
||||
|
||||
```yml
|
||||
# .github/workflows/main.yml
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
backfill-commits:
|
||||
@@ -103,7 +101,7 @@ Keep reading for more cool stuff like:
|
||||
|-----------------------|--------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|-----------|
|
||||
| `GITHUB_TOKEN` | Allows this GitHub Action to make commits for you. Simply pass in `${{ secrets.GITHUB_TOKEN }}`. [Read more](#github_token-). | | 🟩 |
|
||||
| `GIT_EMAIL` | An email address associated with your GitHub account. Without this, contributions won't show up. [Read more](#git_email-). | | 🟩 |
|
||||
| `GIT_BRANCH` | Must either be the default branch (usually `master`) or `gh-pages` for contributions to show up. | `master` | |
|
||||
| `GIT_BRANCH` | Must either be the default branch or `gh-pages` for contributions to show up. | The branch that triggered this Github Action | |
|
||||
| `GIT_COMMIT_MESSAGE` | The message to use for commits made by this GitHub Action. | `chore(actions): empty commit for contribution graph` | |
|
||||
| `ORIGIN_TIMESTAMP` | The unix timestamp to start commits on. If you set `MAX_DAYS` greater than 1, commits will be made on days prior to this time. | The current timestamp | |
|
||||
| `MAX_DAYS` | The maximum integer number of days to commit on. If you want to backfill a year of commits, set this to `365`. | `1` | |
|
||||
|
||||
@@ -9,6 +9,7 @@ import git from 'simple-git/promise';
|
||||
import {getRandomInt} from './random';
|
||||
|
||||
const env = autoParse({
|
||||
GIT_BRANCH: process.env.GIT_BRANCH || process.env.GITHUB_REF.replace(/^refs\/heads\//, ''),
|
||||
ORIGIN_TIMESTAMP: process.env.ORIGIN_TIMESTAMP || getUnixTime(new Date()),
|
||||
...dotenv.load({errorOnMissing: true, includeProcessEnv: true}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user