Skip to content

Commit

Permalink
Use config file (#53)
Browse files Browse the repository at this point in the history
* Update package.json

* Add parseYaml.js

* Update config.js

* Add defaultVals in config.js

* Fix package-lock.json

* Add conf to config.js

* Fix config.js

* Fix config.js, parseYaml.js

* Fix action.yml

* converted inputs to lowercase

* update .prettierignore

* update config.js

* update run-build.yml

* run prettier

* minor fixes

* run build and format

* added sample.yml

* run build and format

* Correct wrong YAML formatting

* Update sample.yml

* Update README.md

* Update test-workflow.yml

* Update sample.yml

* Add #53 to changelog (#56)

* Update CHANGELOG.md

Co-authored-by: Puneet Gopinath <baalkrshna@gmail.com>

* update sample.yml

* update review_approved to changes_approved

* run build and format

Co-authored-by: ABHISHEK Joshi <abhijoshi2k@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Andre_601 <11576465+Andre601@users.noreply.github.com>
  • Loading branch information
4 people authored May 23, 2021
1 parent a33bf4a commit 6bfb4e9
Show file tree
Hide file tree
Showing 31 changed files with 19,237 additions and 18,468 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/run-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ on:
push:
paths:
- "**.js"
- "package.json"
branches: [ main ]
- "**.json"
workflow_dispatch:

jobs:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Dates
DATE_STRING: "Last Updated: {DATE} (GMT)"
CONFIG_FILE: "sample.yml"
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dist\index.js
dist/index.js
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Note that the displayed date is in the format `dd-mm-yyyy`
> **Released:** `TBA`
### Breaking changes
- Timezone can now accept locale string as "continent/city" e.g. GMT+0530 or Asia/Kolkata and `TIMEZONE_OFFSET` input has been renamed to `TIMEZONE` [[#54]]
- Timezone can now accept locale string as "continent/city" e.g. Asia/Kolkata [[#54]]
- Settings have been moved to a YAML file (by default filename is `recent-activity.config.yml` in the `.github` directory and can be changed through `CONFIG_FILE`) [[#53]]

### Added features
- New Action types added [[#50]]
Expand All @@ -34,6 +35,7 @@ Note that the displayed date is in the format `dd-mm-yyyy`
[#42]: https://github.com/Readme-Workflows/recent-activity/pull/42
[#45]: https://github.com/Readme-Workflows/recent-activity/pull/45
[#50]: https://github.com/Readme-Workflows/recent-activity/pull/50
[#53]: https://github.com/Readme-Workflows/recent-activity/pull/53
[#54]: https://github.com/Readme-Workflows/recent-activity/pull/54

## Older changelogs
Expand Down
233 changes: 1 addition & 232 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,245 +31,14 @@ Last Updated: Thursday, May 20th, 2021, 3:17:39 PM (GMT)

## Settings

The Action currently has the following Settings that you can set through the `with` option.

<table>
<thead>
<tr>
<th>Option</th>
<th>Description</th>
<th>Default</th>
<th>Supported Placeholder</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>GH_USERNAME</code></td>
<td>The User to get latest activity from</td>
<td><i>Repository Owner</i></td>
<td></td>
</tr>
<tr>
<td><code>COMMIT_MSG</code></td>
<td>The Commit Message to use when updating the README</td>
<td><code>⚡ Update README with the recent activity</code></td>
<td></td>
</tr>
<tr>
<td><code>MAX_LINES</code></td>
<td>How many activities to display</td>
<td><code>5</code></td>
<td></td>
</tr>
<tr>
<td><code>README_FILE</code></td>
<td>The location of the README.md (or any Markdown file) relative to the root directory.</td>
<td><code>./README.md</code></td>
<td></td>
</tr>
<tr>
<td>&#8203;</td>
<td>&#8203;</td>
<td>&#8203;</td>
<td>&#8203;</td>
</tr>
<tr>
<td><code>COMMENTS_ACTIVITY</code></td>
<td>Text displayed when making a comment.<br/>Includes comments on Issues and Pull requests</td>
<td><code>💬 Commented on {ID} in {REPO}</code></td>
<td><code>{REPO}</code><br/><code>{ID}</code><br/><code>{URL}</code></td>
</tr>
<tr>
<td><code>ISSUE_OPENED</code></td>
<td>Text displayed when opening an issue.</td>
<td><code>❗️ Opened issue {ID} in {REPO}</code></td>
<td><code>{REPO}</code><br/><code>{ID}</code><br/><code>{URL}</code></td>
</tr>
<tr>
<td><code>ISSUE_CLOSED</code></td>
<td>Text displayed when closing an issue.</td>
<td><code>✔ Closed issue {ID} in {REPO}</code></td>
<td><code>{REPO}</code><br/><code>{ID}</code><br/><code>{URL}</code></td>
</tr>
<tr>
<td><code>PR_OPENED</code></td>
<td>Text displayed when opening a Pull request.</td>
<td><code>💪 Opened PR {ID} in {REPO}</code></td>
<td><code>{REPO}</code><br/><code>{ID}</code><br/><code>{URL}</code></td>
</tr>
<tr>
<td><code>PR_CLOSED</code></td>
<td>Text displayed when closing a Pull request without merging.</td>
<td><code>❌ Closed PR {ID} in {REPO}</code></td>
<td><code>{REPO}</code><br/><code>{ID}</code><br/><code>{URL}</code></td>
</tr>
<tr>
<td><code>PR_MERGED</code></td>
<td>Text displayed when merging a Pull request.</td>
<td><code>🎉 Merged PR {ID} in {REPO}</code></td>
<td><code>{REPO}</code><br/><code>{ID}</code><br/><code>{URL}</code></td>
</tr>
<tr>
<td><code>CREATE_REPO</code></td>
<td>Text displayed when creating a new Repository.</td>
<td><code>📔 Created new repository {REPO}</code></td>
<td><code>{REPO}</code</td>
</tr>
<tr>
<td><code>FORK_REPO</code></td>
<td>Text displayed when forking a repo.</td>
<td><code>🔱 Forked {FORK} from {REPO}</code></td>
<td><code>{FORK}</code><br/><code>{REPO}</code></td>
</tr>
<tr>
<td><code>WIKI_CREATE</code></td>
<td>Text displayed when creating a wiki page.</td>
<td><code>📖 Created new wiki page {WIKI} in {REPO}</code></td>
<td><code>{WIKI}</code><br/><code>{REPO}</code></td>
</tr>
<tr>
<td><code>ADDED_MEMBER</code></td>
<td>Text displayed when you are added as a collaborator to a repo.</td>
<td><code>🤝 Became collaborator on {REPO}</code></td>
<td><code>{REPO}</code></td>
</tr>
<tr>
<td><code>REVIEW_APPROVED</code></td>
<td>Text displayed when you approved a pr.</td>
<td><code>👍 Approved {ID} in {REPO}</code></td>
<td><code>{ID}</code><br/><code>{REPO}</code><br/><code>{URL}</code></td>
</tr>
<tr>
<td><code>CHANGES_REQUESTED</code></td>
<td>Text displayed when you requested changes when approving a pr.</td>
<td><code>🔴 Requested changes in {ID} in {REPO}</code></td>
<td><code>{ID}</code><br/><code>{REPO}</code><br/><code>{URL}</code></td>
</tr>
<tr>
<td><code>RELEASE</code></td>
<td>Text displayed when you release new version in a repo.</td>
<td><code>✌️ Released {ID} in {REPO}</code></td>
<td><code>{ID}</code><br/><code>{REPO}</code></td>
</tr>
<tr>
<td><code>STAR</code></td>
<td>Text displayed when you star a repo.</td>
<td><code>⭐ Starred {REPO}</code></td>
<td><code>{REPO}</code></td>
</tr>
<tr>
<td>&#8203;</td>
<td>&#8203;</td>
<td>&#8203;</td>
<td>&#8203;</td>
</tr>
<tr>
<td><code>DISABLE_EVENTS</code></td>
<td>Comma-separated String of Events to disable.<br/>Available are <code>ISSUES</code>, <code>PR</code>, <code>COMMENTS</code>, <code>CREATE_REPO</code>, <code>FORK</code>, <code>WIKI</code>, <code>MEMBER</code>, <code>REVIEW</code>, <code>RELEASE</code> and <code>STAR</code></td>
<td><i>Empty String</i></td>
<td></td>
</tr>
</tr>
<td>&#8203;</td>
<td>&#8203;</td>
<td>&#8203;</td>
<td>&#8203;</td>
</tr>
<tr>
<td><code>URL_TEXT</code></td>
<td>Text to display when using the <code>{URL}</code> placeholder.See the <a href="#placeholders">Placeholders section</a> for more info.</td>
<td><code>{REPO}{ID}</code></td>
<td><code>{REPO}</code><br/><code>{ID}</code></td>
</tr>
</tr>
<td>&#8203;</td>
<td>&#8203;</td>
<td>&#8203;</td>
<td>&#8203;</td>
</tr>
<tr>
<td><code>TIMEZONE</code></td>
<td>Timezone in which the date and time should be displayed.<br>The format is <code>+xx:xx</code> / <code>-xx:xx</code> / <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"><code>continent/city</code></a> and is relative to the GMT timezone. <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">Supported locale-based timezones</a></td>
<td>0</td>
<td></td>
</tr>
<tr>
<td><code>DATE_STRING</code></td>
<td>The text to print when using the <a href="#options"><code>RECENT_ACTIVITY:last_update</code></a> Comment option.</td>
<td>Last Updated: {DATE}</td>
<td><code>{DATE}</code></td>
</tr>
<tr>
<td><code>DATE_FORMAT</code></td>
<td>The date and time format which should be used for the <code>{DATE}</code> Placeholder.<br><a href="https://www.npmjs.com/package/dateformat">More info about the Date formatting</a></td>
<td>dddd, mmmm dS, yyyy, h:MM:ss TT</td>
<td></td>
</tr>
</tbody>
</table>

### Placeholders

The following placeholders may be used in the aforementioned settings, if the `Supported Placeholders` section lists them.

**Important Notes:**

- Each placeholder with exception of `{DATE}` will turn into an embedded link pointing to the issue, pull request or discussion of that respective action.
For example will `{ID}` turn into `[#:id](:url)` and `{URL}` turns into `[:url_text](:url)`.
- Using `{ID}` or `{REPO}` in the `URL_TEXT` setting won't turn them into embedded links. `{ID}` will still have a `#` before it.

<table>
<thead>
<tr>
<th>Placeholder</th>
<th>Description</th>
<th>Example Output</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>{REPO}</code></td>
<td>Displays the username and Repository in the <code>:username/:repository</code> format.</td>
<td><a href="https://github.com/Readme-Workflows/recent-activity/discussions/1">Readme-Workflows/recent-activity</a></td>
</tr>
<tr>
<td><code>{ID}</code></td>
<td>Displays the issue, pull request or discussion ID with a <code>#</code> added in front of it</td>
<td><a href="https://github.com/Readme-Workflows/recent-activity/discussions/1">#1</a></td>
</tr>
<tr>
<td><code>{URL}</code></td>
<td>Displays the text provided by <code>URL_TEXT</code>.</td>
<td><a href="https://github.com/Readme-Workflows/recent-activity/discussions/1">Readme-Workflows/recent-activity#1</a></td>
</tr>
<tr>
<td><code>{DATE}</code></td>
<td>Current time and date to display.<br>This is <b>ONLY</b> usable in the <a href="#settings">DATE_STRING</a> setting!</b></td>
<td>01.01.2021 00:00:00</td>
</tr>
<tr>
<td><code>{FORK}</code></td>
<td>The forked repo name.</td>
<td>Readme-Workflows/forked-repo</td>
</tr>
<tr>
<td><code>{WIKI}</code></td>
<td>The Wiki page name</b></td>
<td>Home</td>
</tr>
</tbody>
</table>
All available settings can be found on the [Wiki](https://github.com/Readme-Workflows/recent-activity/wiki/Configuration).

## History

- The original project was inspired by [JasonEtco/activity-box](https://github.com/JasonEtco/activity-box)
- Puneet and Abhishek wanted to add a new feature, the original project was no longer maintained, so Puneet created a fork and Abhishek supported him.
- Andre joined to support us in documentation

## Examples

A list of examples can be found on the [Wiki](https://github.com/Readme-Workflows/recent-activity/wiki/Examples)

## Community

Get updates on Recent Activity's development and chat with the Recent Activity maintainers and community members.
Expand Down
Loading

0 comments on commit 6bfb4e9

Please sign in to comment.