-
Notifications
You must be signed in to change notification settings - Fork 46
Examples
This page is outdated and won't receive any further updates.
It remains to keep a place for people still using versionsv1.3.0
and older. Please consider updating tov2.0.0
or newer to use the new Configuration file.
This page contains examples of using various options of this GitHub Action and also displays example outputs of those settings.
Make sure to replace {version}
with the latest release available.
- Different delays
- More displayed Activities
- Different Commit Message
- Different Activity Messages
- Disable specific Activities
- Different
{URL}
text - Different Date and time format
This GitHub Action is best used with the schedule action available, as this one allows you to update the README periodically with the latest information.
The schedule event uses the Cron Syntax to set when a GitHub Action should be executed.
It's recommended to use a website such as crontab.guru to create and evaluate different Cron Syntaxes.
Here are some example syntaxes you can use:
-
*/30 * * * *
- Execute the action every 30 minutes (48 times a day) -
0,30 * * * *
- Execute the action at XX:00 and XX:30 (48 times a day)
This is essentially the same as the previous option but for precise times. -
0 */12 * * *
- Execute the action every 12 hours (2 times a day) -
0 0,12 * * *
- Execute the action at 00:00 and 12:00 (2 times a day)
This is essentially the same as the previous action but for precise times. -
0 0 */1 * *
- Execute the action once a day at 00:00 (1 time a day)
It's recommended to use exact numbers for lower values (i.e. minutes) when using higher numbers (i.e. hours) as it could otherwise be treated as run action every X after Y (X being the lower value type and Y being the higher one).
For example, would * */12 * * *
result in the action being executed every 5 minutes once 12 hours passed.
The MAX_LINES
option allows you to set a higher number of lines to display.
Something worth mentioning is, that the Action will add a <!--RECENT_ACTIVITY:end-->
HTML Comment when it doesn't exist.
When this comment does exist will the Action add entries to the list until it reaches this commend or reaches MAX_LINES
amount. Whichever happens first.
This means that the Action won't go past X entries when it hits the comment before MAX_LINES
of entries was reached.
To fix this, simply remove the <!--RECENT_ACTIVITY:end-->
comment together with any existing List entry and trigger the action again.
YAML-Example:
name: Update README
on:
schedule:
- cron: "*/30 * * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Update Profile README
steps:
- uses: actions/[email protected]
- uses: Readme-Workflows/recent-activity@{version}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
MAX_LINES: 10
Output:
- βοΈ Closed issue #5 in Readme-Workflows/recent-activity
- π Merged PR #6 in Readme-Workflows/recent-activity
- π£ Commented on #3 in Readme-Workflows/recent-activity
- βοΈ Closed issue #4 in Readme-Workflows/recent-activity
- πͺ Opened PR #6 in Readme-Workflows/recent-activity
- βοΈ Opened issue #5 in Readme-Workflows/recent-activity
- π£ Commented on #3 in Readme-Workflows/recent-activity
- βοΈ Opened issue #4 in Readme-Workflows/recent-activity
- π£ Commented on #3 in Readme-Workflows/recent-activity
- π£ Commented on #1 in Readme-Workflows/recent-activity
With COMMIT_MSG
can you change the message that should be displayed when the Action performs a Commit to the README file.
YAML Example:
name: Update README
on:
schedule:
- cron: "*/30 * * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Update Profile README
steps:
- uses: actions/[email protected]
- uses: Readme-Workflows/recent-activity@{version}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
COMMIT_MSG: "Update README with latest Activities"
You may want to display a different message for a specific activity.
For that purpose does the Action offer settings to change the message used for each Activity type.
You can also use {ID}
, {REPO}
and {URL}
in the messages which would be replaced with their respective values. Refer to the Placeholder section to learn more about them.
YAML Example:
name: Update README
on:
schedule:
- cron: "*/30 * * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Update Profile README
steps:
- uses: actions/[email protected]
- uses: Readme-Workflows/recent-activity@{version}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
COMMENTS_ACTIVITY: "Gave a comment on {ID} in {REPO}"
ISSUE_OPENED: "Made Issue {ID} in {REPO}"
ISSUE_CLOSED: "Closed Issue {ID} in {REPO}"
PR_OPENED: "Made Pull request {ID} in {REPO}"
PR_CLOSED: "Closed Pull request {ID} in {REPO}"
PR_MERGED: "Merged Pull request {ID} in {REPO}"
Output:
- Closed issue #5 in Readme-Workflows/recent-activity
- Merged Pull request #6 in Readme-Workflows/recent-activity
- Gave a comment on #3 in Readme-Workflows/recent-activity
- Closed issue #4 in Readme-Workflows/recent-activity
- Made Pull request #6 in Readme-Workflows/recent-activity
If you don't want to display specific activities on your list, or a specific one such as commenting fills it up completely, can you use the DISABLE_EVENTS
Setting to disable specific activities.
The option is a String and the different events are separated by a comma.
Currently available options are ISSUE
, PR
and COMMENTS
.
YAML Example:
name: Update README
on:
schedule:
- cron: "*/30 * * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Update Profile README
steps:
- uses: actions/[email protected]
- uses: Readme-Workflows/recent-activity@{version}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
DISABLE_EVENTS: "COMMENTS"
Output:
- βοΈ Closed issue #5 in Readme-Workflows/recent-activity
- π Merged PR #6 in Readme-Workflows/recent-activity
- βοΈ Closed issue #4 in Readme-Workflows/recent-activity
- πͺ Opened PR #6 in Readme-Workflows/recent-activity
- βοΈ Opened issue #5 in Readme-Workflows/recent-activity
The {URL}
option has a unique tweak by allowing you to customize the text displayed by it.
Keep in mind that the text itself will be used as an embedded URL, meaning that a text such as {ID} in {REPO}
will turn into [{ID} in {REPO}](:URL)
Something else to point out is, that you can use {ID}
and {REPO}
and unlike in the other options will they NOT be turned into embedded links. {ID}
will still have a #
prefixed, however.
YAML Example
name: Update README
on:
schedule:
- cron: "*/30 * * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Update Profile README
steps:
- uses: actions/[email protected]
- uses: Readme-Workflows/recent-activity@{version}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
URL_TEXT: "`{REPO}{ID}`" # Turns {URL} into [`{REPO}{ID}`](:url)
PR_OPENED: "Made Pull request {URL}"
PR_CLOSED: "Closed Pull request {URL}"
PR_MERGED: "Merged Pull request {URL}"
Output:
- βοΈ Closed issue #5 in Readme-Workflows/recent-activity
- Merged Pull request
Readme-Workflows/recent-activity#6
- π£ Commented on #3 in Readme-Workflows/recent-activity
- βοΈ Closed issue #4 in Readme-Workflows/recent-activity
- Made Pull request
Readme-Workflows/recent-activity#6
Version 1.3.0 added options to display a date and time of when the Activity-list was last updated.
By default is the displayed text Last Updated: {DATE}
where {DATE}
is the pattern dddd, mmmm dS, yyyy, h:MM:ss TT
with timezone GMT+0000
.
You may want to change this text and time which Recent-Activity allows.
YAML Example
name: Update README
on:
schedule:
- cron: "*/30 * * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Update Profile README
steps:
- uses: actions/[email protected]
- uses: Readme-Workflows/recent-activity@{version}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
TIMEZONE_OFFSET: "+1:00"
DATE_STRING: "Last update: `{DATE}`"
DATE_FORMAT: "dd.mm.yyyy HH:MM:ss"
Notes:
- To display the date will you need to use the
<!--RECENT_ACTIVITY:last_update-->
comment. - The
TIMEZONE_OFFSET
is in the format+xx:xx
/-xx:xx
and always relative to GMT. So a value of+1:00
becomesGMT+0100
Read more about the Date format here.
Output:
Last update: 01.01.2021 00:00:00
- βοΈ Closed issue #5 in Readme-Workflows/recent-activity
- π Merged PR #6 in Readme-Workflows/recent-activity
- π£ Commented on #3 in Readme-Workflows/recent-activity
- βοΈ Closed issue #4 in Readme-Workflows/recent-activity
- πͺ Opened PR #6 in Readme-Workflows/recent-activity
Copyright Β© 2021 Readme-Workflows Team and Contributors
Have ideas for the wiki? Let us know or PR it yourself!