diff --git a/scripts/config/vale/styles/Vocab/words/accept.txt b/scripts/config/vale/styles/Vocab/words/accept.txt index dc124c0..43298b2 100644 --- a/scripts/config/vale/styles/Vocab/words/accept.txt +++ b/scripts/config/vale/styles/Vocab/words/accept.txt @@ -24,3 +24,4 @@ drawio rawContent endcapture Cognito +Jira diff --git a/scripts/git-repo/auto-link.md b/scripts/git-repo/auto-link.md new file mode 100644 index 0000000..b09bc7c --- /dev/null +++ b/scripts/git-repo/auto-link.md @@ -0,0 +1,11 @@ +# GitHub + +## Auto link Protection Rules + +This will create the auto link to Jira. + +```sh +./auto-link.sh $reponame $PAT +``` + +PAT must have `administration:write`. [Create a repository rule set](https://docs.github.com/en/rest/repos/autolinks?apiVersion=2022-11-28#create-an-autolink-for-a-repository) diff --git a/scripts/git-repo/auto-link.sh b/scripts/git-repo/auto-link.sh index 8fec326..a827bd0 100644 --- a/scripts/git-repo/auto-link.sh +++ b/scripts/git-repo/auto-link.sh @@ -1,3 +1,9 @@ #!/bin/bash -curl --location "https://api.github.com/repos/NHSDigital/$1/rulesets" \ +curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $2" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/NHSDigital/$1/autolinks \ + -d '{"key_prefix":"CCM-","url_template":" https://nhsd-jira.digital.nhs.uk/browse/CCM-","is_alphanumeric":true}'