Last active
January 2, 2023 06:22
-
-
Save rajesh-s/749c99ef9e7c884828a1acda698e477b to your computer and use it in GitHub Desktop.
Github Workflow to automatically run note-link-janitor on each push
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# Copy this file with the same name "note-link-janitor-gh-action-workflow.yml" to the <repo>/.github/workflows/ folder | |
# I keep all my *.md files in SRC and run janitor only on that folder. If you keep it in the root of repository or any other folder, feel free to update it on line 37 of this file | |
# The workflow gets triggered every time you push to your repository | |
name: note-link-janitor-gh-action-workflow | |
# Run this workflow every time a new commit pushed to your repository | |
on: push | |
jobs: | |
# Set the job key. The key is displayed as the job name | |
# when a job name is not provided | |
note-link-janitor-run: | |
# Name the Job | |
name: Note Link Janitor Run | |
# Set the type of machine to run on | |
runs-on: ubuntu-latest | |
steps: | |
# Checks out a copy of your repository on the ubuntu-latest machine | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
path: '${{ github.event.repository.name }}' | |
- name: Setup Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '12' | |
- name: Checkout code from note-link-janitor | |
uses: actions/checkout@v2 | |
with: | |
repository: 'thats-all-forks/note-link-janitor' | |
path: 'note-link-janitor' | |
- run: cd ${{ github.workspace }}/note-link-janitor && yarn install && yarn run build | |
- name: Run Note Link Janitor | |
# Runs note-link-janitor only on the src folder in the repo where the *.md files are. Modify this as per your own setup | |
run: ${{ github.workspace }}/note-link-janitor/dist/index.js ${{ github.workspace }}/${{ github.event.repository.name }}/src | |
- run: cd ${{ github.workspace }}/${{ github.event.repository.name }} && git status . | |
- name: Commit changes | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
repository: ${{ github.workspace }}/${{ github.event.repository.name }}/ | |
commit_message: Github Actions - Apply note link janitor changes | |
# Optional commit user and author settings | |
#commit_user_name: Notion Backup GitHub Actions Bot # defaults to "GitHub Actions" | |
#commit_user_email: actions@github.com # defaults to "actions@github.com" | |
#commit_author: GitHub Actions Bot <actions@github.com> # defaults to author of the commit that triggered the run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment