Skip to content

Commit

Permalink
First working version
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitor Monteiro committed Feb 26, 2020
0 parents commit 90fe622
Show file tree
Hide file tree
Showing 10 changed files with 27,702 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on: [push]

jobs:
make_report:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Audit Log Action
uses: ./
id: audit-log-action
with:
org: 'octodemo'
token: ${{ secrets.TOKEN }}
issue: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
data
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 GitHub Actions

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
84 changes: 84 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Organization Audit Action

GitHub Action that provides an Organization Audit. The output of this action is a published CSV file in the Actions tab. The user can also configure the action to publish the results to an issue. The output looks like:

| org | repo | user | permission |
|----------|------------------------|-----------------------|------------|
| octodemo | ReadingTimeDemo | Nathan Peter. | ADMIN |
| octodemo | ReadingTimeDemo | Eric Mild. | ADMIN |
| octodemo | ReadingTimeDemo | Aziz MyMan | ADMIN |
| octodemo | ReadingTimeDemo | Brent Wine | ADMIN |
| octodemo | ReadingTimeDemo | Yuichi Katana | ADMIN |
| octodemo | ReadingTimeDemo | Chris Monteiro | WRITE |

## Example workflows

Depending on your needs you might want to trigger the audit on different events. The simplest one to test it out is to trigger the workflow on push. For this workflow to run properly you'll need to provide it with a secret personal access token from someone that is an org owner or from an application that has that privilege. Providing it a lesser scope might not show all the information for the organization.

### Audit on push (for testing)

The `issue` is optional.

```yml
on: push

jobs:

audit_log:
runs-on: ubuntu-latest
name: Org Membership Audit Log

- name: Org Membership Audit Log Action
uses: svanboxel/org-audit-action@alpha
with:
org: 'octodemov2'
token: ${{ secrets.TOKEN }}
issue: true
```
### Audit on a schedule (cron)
```yml
on:
schedule:
# Once a week on Saturday 00:00
- cron: '0 0 * * 6'

jobs:

audit_log:
runs-on: ubuntu-latest
name: Org Membership Audit Log

- name: Org Membership Audit Log Action
uses: svanboxel/org-audit-action@alpha
with:
org: 'octodemov2'
token: ${{ secrets.TOKEN }}
issue: true
```
### Audit triggered by an external service
Use a [`repository_dispatch`](https://developer.github.com/v3/repos/#create-a-repository-dispatch-event) event to trigger this workflow.

```yml
on: repository_dispatch
jobs:
audit_log:
runs-on: ubuntu-latest
name: Org Membership Audit Log
- name: Org Membership Audit Log Action
uses: svanboxel/org-audit-action@alpha
with:
org: 'octodemov2'
token: ${{ secrets.TOKEN }}
issue: true
```

## Help us improve it

Open an issue on: https://github.com/svanboxel/org-audit-action
19 changes: 19 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Organization Membership Audit Action'
description: 'Outputs details of organization membership and user access'
inputs:
org:
description: 'Organization'
required: true
token:
description: 'Token from Org owner'
required: true
issue:
description: 'If you want the output on a new issue or not'
required: false
default: false
outputs:
org:
description: 'The org used'
runs:
using: 'node12'
main: 'dist/index.js'
Loading

0 comments on commit 90fe622

Please sign in to comment.