Skip to content

A GitHub Actions action to sync GitHub Issues to Git notes

Notifications You must be signed in to change notification settings

TomasHubelbauer/github-issues-git-notes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

GitHub Issues Git Notes GitHub Action

This GitHub Action stores the API payload from the GET /issues API call into the Git notes ref of the repository it has run for.

This repository implements a GitHub Actions that takes the GitHub Issues (backed by the GitHub database not the Git objects) of the GitHub repository it runs on using the GitHub API and stores the JSON in the Git repository's Git Notes.

This action should be run on all issues & issue_comment trigger events. demo.

Git notes are pushed back to the repository using git push origin refs/notes/* and with the GitHub Actions Git identity.

The note is added to the repository's default branch's ref, associated to the branch's tip commit. If the workflow runs multiple times for the same commit, it will update the note for that commit.

Git notes can be fetched locally by using git fetch with the notes ref: git fetch origin "+refs/notes/*:refs/notes/*". This will replace local notes.

To view notes for the main branch, run the Git log command with %N format: git log --pretty=format:"%ai%n %H%n %s%n %N%n" --show-notes main.

Usage

.github/workflows/main.yml:

name: main
on:
  issues:
  issue_comment:

jobs:
  main:
    runs-on: ubuntu-latest
    steps:
    - name: Back up GitHub Issues to Git notes
      uses: tomashubelbauer/github-issues-git-notes@main

You can see this in action (pun intended) in this GitHub repository: https://github.com/TomasHubelbauer/github-issues-git-notes-demo

I have not published this GitHub Action to the GitHub Marketplace.

Development

  1. Make a change here
  2. Go to https://github.com/TomasHubelbauer/github-issues-git-notes-demo/actions/workflows/main.yml
  3. Click Run workflow

Contributing

I am not likely to accept contributions unless they benefit my use-case.

Feel free to fork the action and adjust it to suit your needs.

About

A GitHub Actions action to sync GitHub Issues to Git notes

Topics

Resources

Stars

Watchers

Forks