docs(contributing): add custom text section

This commit is contained in:
Borja Canseco
2020-06-05 21:13:02 -05:00
parent 245b80f3d0
commit 68009be8b8
2 changed files with 16 additions and 3 deletions

View File

@@ -65,3 +65,17 @@ Two reasons:
1. GitHub transforms input parameter casing and prepends `INPUT_`, so additional code would be necessary to revert this before processing them.
1. Input parameters are expected to be documented in the [action definition](../action.yml), which would be yet another source of truth to maintain.
### Why not add a cool `CUSTOM_TEXT` feature for writing on the grid? 🎨
This is a great idea! In theory, this GitHub Action could re-draw your custom string of text every week or so. That way it stays in the center of your contribution graph.
Unfortunately though, commits made on a GitHub repository will always show on the graph even if those commits are later removed through a force push. This means that every time we would try to re-draw, the old text would remain on your graph.
You can already imagine the consequences:
* Text overlapping
* Seeing last year's strings cut-off
* Repeated text
A workaround involves deleting and recreating the GitHub repo for the user on each run, but that requires permissions that the `GITHUB_TOKEN` doesn't provide. For now I'm calling this out-of-scope, but feel free to open an issue if you have any ideas.

View File

@@ -12,11 +12,10 @@ const env = autoParse({
ORIGIN_TIMESTAMP: process.env.ORIGIN_TIMESTAMP || getUnixTime(new Date()),
...dotenv.load({errorOnMissing: true, includeProcessEnv: true}),
});
const repoPath = `https://${env.GITHUB_ACTOR}:${env.GITHUB_TOKEN}@${env.GIT_HOST}/${env.GITHUB_REPOSITORY}`;
const localPath = './clone';
const repoPath = `https://${env.GITHUB_ACTOR}:${env.GITHUB_TOKEN}@${env.GIT_HOST}/${env.GITHUB_REPOSITORY}`;
const secondLine = 'Committed via https://github.com/marketplace/actions/autopopulate-your-contribution-graph';
const dayOffsets = [...Array(env.MAX_DAYS).keys()];
const originDay = fromUnixTime(env.ORIGIN_TIMESTAMP);
await fs.mkdir(localPath);
@@ -31,7 +30,7 @@ await git(localPath).addConfig('user.name', env.GITHUB_ACTOR);
await git(localPath).addConfig('user.email', env.GIT_EMAIL);
await dayOffsets
.map((dayOffset) => subDays(dayOffset, originDay))
.map((dayOffset) => subDays(dayOffset, fromUnixTime(env.ORIGIN_TIMESTAMP)))
.filter((day) => !(!env.INCLUDE_WEEKENDS && isWeekend(day)))
.filter((day) => !(!env.INCLUDE_WEEKDAYS && !isWeekend(day)))
.map((/** @type {Date} */ day) => {