Skip to content

Latest commit

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Add, override and output git notes

Action allowing to manipulate git notes in several stages of your pipeline.

"A typical use of notes is to supplement a commit message without changing the commit itself."

man 1 git-notes

One use case example is, which made me create this, was that I needed to pass on a single string from one workflow A to another workflow B, B was triggered on A's completion. It seemed too overkill to upload an artifact to do it so, and the information being passed on was contextual to the commit, so here we are.

This is the only use case for now.

Only tested on linux & mac.

If you are Adding / Overriding notes and not only reading, you need to clone your repository with a PAT(Personal Access Token).

Usage

- id: example-runname: Notes Actionuses: marcoslopes/git-notes-actionwith:
# Required, which object to attach note tosha: ${{ github.sha }}# Optional, Notes message, if present will Add / Override*message: "optional message"# Optional, Remote to fetch / push notes toremote: "origin"# Optional, repository path, defaults to current directorypath: "."# Optional, notes refref: "commits"# Optional, override note with current 'message' if trueoverride: false# Optional, git config user.namename: "Git Notes Action"# Optional, git config user.emailemail: "git-notes-action@users.noreply.github.com"

Examples

writing value

...
- name: checkout sourceuses: actions/checkout@v2with:
fetch-depth: 1token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
- id: save-valueuses: marcoslopes/git-notes-action@v1with:
sha: ${{ github.sha }}ref: 'some-other-scope'message: "${{ steps.some-previous-step.outputs.some-value }}"
# download all notes refs
git fetch origin "refs/notes/*:refs/notes/*" -f
# show notes from all refs
git log --show-notes="*"
# show notes from some-other-scope ref
git log --show-notes="some-other-scope"
...
commit 0000000000000000000000000000000000000000 (HEAD -> main, origin/main)
Author: Marcos Antonio Lopes <marcos@domain.com>
Date: Sun Oct 00 00:00:00 2021 +1300
test notes commit
Notes (some-other-scope):
some-value-from-some-previous-step-output
...

reading value

...
- id: get-valueuses: marcoslopes/git-notes-action@v1with:
sha: ${{ github.sha }}ref: 'some-other-scope'
- id: use-valuerun: | echo "value from note ${{ steps.get-value.outputs.message }}"...

About

Git notes action

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors