Skip to content

Commit

Permalink
feat: Created shared workflow for readme generator (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
VishwajitNagulkar authored Nov 16, 2023
1 parent 5d41248 commit 4ba1097
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 22 deletions.
65 changes: 43 additions & 22 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,67 @@
---
name: Create README.md file
run-name: 'Readme workflow'
on:
workflow_call: null
workflow_call:
secrets:
TOKEN:
required: true
description: 'GitHub Token.'
SLACK_WEBHOOK_TERRAFORM:
required: true
description: 'Slack webhook url.'

jobs:
readme-create:
name: readme-create
readme-workflow:
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Updating GitHub Token
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
run: echo "GH_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV

- name: checkout
uses: actions/checkout@master
- name: Set up Python 3.7
with:
fetch-depth: 0
ref: master
token: ${{ env.GH_TOKEN }}

- name: 'Set up Python 3.7'
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: create readme
uses: clouddrove/[email protected]
python-version: '3.x'

- name: 'create readme'
uses: 'clouddrove/[email protected]'
with:
actions_subcommand: readme
github_token: ${{ secrets.GITHUB }}
actions_subcommand: 'readme'
github_token: '${{ secrets.TOKEN }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: pre-commit check errors
GITHUB_TOKEN: ${{ secrets.TOKEN}}

- name: 'pre-commit check errors'
uses: pre-commit/[email protected]
continue-on-error: true
- name: pre-commit fix erros

- name: 'pre-commit fix erros'
uses: pre-commit/[email protected]
continue-on-error: true
- name: push readme
uses: clouddrove/[email protected]
continue-on-error: true

- name: 'push readme'
uses: 'clouddrove/[email protected]'
with:
actions_subcommand: push
actions_subcommand: 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Slack Notification
GITHUB_TOKEN: ${{ secrets.TOKEN}}

- name: 'Slack Notification'
uses: clouddrove/action-slack@v2
with:
status: ${{ job.status }}
fields: repo,author
author_name: CloudDrove
author_name: 'CloudDrove'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }}
if: always()
...
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Above example is just a simple example to call workflow from github shared workf
9. [Infracost workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/infracost.md)
10. [ Deploy Cloudformation Stack workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/deploy-cloudformation.md)
11. [ Deploy Cloudformation Stackset workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/deploy-cloudformation-stackset.md)
12. [ Readme Generation workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/readme.md)
## Feedback
If you come accross a bug or have any feedback, please log it in our [issue tracker](https://github.com/clouddrove/github-shared-workflows/issues), or feel free to drop us an email at [[email protected]](mailto:[email protected]).
Expand Down
21 changes: 21 additions & 0 deletions docs/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## [Readme Workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/.github/workflows/readme.yml)

This workflow is used to generate readme for TErraform modules using GitHub Actions. It utilizes the workflows defined in `.github/workflows/readme.yml`

#### Example of a readme workflow
```yaml
name: readme workflow
on:
push:
branches:
- master
paths-ignore:
- 'README.md'
workflow_dispatch:
jobs:
assignee:
uses: clouddrove/github-shared-workflows/.github/workflows/readme.yml@master
secrets:
TOKEN : # Provide GitHub token
SLACK_WEBHOOK_TERRAFORM: # Provide slack-webhook url
```

0 comments on commit 4ba1097

Please sign in to comment.