Github notion task id detector

Detect notion task id from default name by git branch

As of 2023-11-02. See the latest version.

  1. // ==UserScript==
  2. // @name Github notion task id detector
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Detect notion task id from default name by git branch
  6. // @author Yes
  7. // @match https://github.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. setInterval(function() {
  16. const prTitle = document.getElementById('pull_request_title')
  17.  
  18. if (!prTitle) return
  19.  
  20. const prTitleText = prTitle.value
  21.  
  22. const match = prTitleText.match(/(Tas \d+?) (.*)/)
  23. if (match) {
  24. let notionId = match[1].split(' ')
  25.  
  26. notionId = `[${notionId[0].toUpperCase()}-${notionId[1]}]`
  27.  
  28. prTitle.value = `${notionId} ${match[2]}`
  29. }
  30. }, 1000);
  31. })();