Go to file
2024-07-15 10:33:53 -04:00
dist Take values file as an input 2024-07-15 10:33:53 -04:00
src Take values file as an input 2024-07-15 10:33:53 -04:00
.eslintignore Initialize with v0.1 2024-07-11 13:39:35 -04:00
.gitignore Initialize with v0.1 2024-07-11 13:39:35 -04:00
.prettierignore Initialize with v0.1 2024-07-11 13:39:35 -04:00
.prettierrc.json Take values file as an input 2024-07-15 10:33:53 -04:00
action.yml Take values file as an input 2024-07-15 10:33:53 -04:00
package-lock.json Take values file as an input 2024-07-15 10:33:53 -04:00
package.json Initialize with v0.1 2024-07-11 13:39:35 -04:00
README.md Initialize with v0.1 2024-07-11 13:39:35 -04:00
tsconfig.json Initialize with v0.1 2024-07-11 13:39:35 -04:00

Notes-KV

A GitHub/Gitea/AllSpice Hub action to use git-notes as a Key/Value store.

Usage

jobs:
  save-metadata:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Configure git user
        run: |
          git config --global user.email "<your email here>"
          git config --global user.name "<your name here>"          
      - name: Save metadata to git notes
        uses: AllSpiceIO/notes-kv@v0.1
        with:
          values: |
            build_number=${{ github.run_number }}
            commit_sha=${{ github.sha }}
            author=${{ github.actor }}            

This action automatically pulls notes from the origin remote and pushes them back after changes. If there are already key/values stored in the notes, they will be merged with the new values.

This action uses a custom ref, notes-kv to avoid conflicts with other notes. If you want to use your own ref, you can set it using custom_ref:

- name: Save metadata to git notes
  uses: AllSpiceIO/notes-kv@v0.1
  with:
    custom_ref: my-notes
    values: |
      build_number=${{ github.run_number }}
      commit_sha=${{ github.sha }}
      author=${{ github.actor }}      

For more information on git notes, refer to the Git documentation.

Caveats

  • The git user should be configured before this action is run:

    git config --global user.email "demo@example.org"
    git config --global user.name "Demo"
    
  • You should be able to push to the repository without entering a password.

  • If you have multiple runs at the same time, this action has a potential race condition where the notes could be overwritten by another run.