Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support for fine grained tokens #268

Merged
merged 1 commit into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ inputs:
description: |
The path for the sync configuration file
required: false
IS_FINE_GRAINED:
description: |
Label GH_PAT as a fine grained token
required: false
PR_LABELS:
description: |
Labels which will be added to the pull request. Defaults to sync. Set to false to turn off
Expand Down
7 changes: 6 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21277,6 +21277,10 @@ try {
key: 'CONFIG_PATH',
default: '.github/sync.yml'
}),
IS_FINE_GRAINED: getInput({
key: 'IS_FINE_GRAINED',
default: false
}),
COMMIT_BODY: getInput({
key: 'COMMIT_BODY',
default: ''
Expand Down Expand Up @@ -21506,6 +21510,7 @@ const fs = __nccwpck_require__(7147)
const {
GITHUB_TOKEN,
IS_INSTALLATION_TOKEN,
IS_FINE_GRAINED,
GIT_USERNAME,
GIT_EMAIL,
TMP_DIR,
Expand Down Expand Up @@ -21553,7 +21558,7 @@ class Git {
// Set values to current repo
this.repo = repo
this.workingDir = path.join(TMP_DIR, repo.uniqueName)
this.gitUrl = `https://${ IS_INSTALLATION_TOKEN ? 'x-access-token:' : '' }${ GITHUB_TOKEN }@${ repo.fullName }.git`
this.gitUrl = `https://${ IS_INSTALLATION_TOKEN ? 'x-access-token:' : '' }${ IS_FINE_GRAINED ? 'oauth:' : '' }${ GITHUB_TOKEN }@${ repo.fullName }.git`

await this.clone()
await this.setIdentity()
Expand Down
4 changes: 4 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ try {
key: 'CONFIG_PATH',
default: '.github/sync.yml'
}),
IS_FINE_GRAINED: getInput({
key: 'IS_FINE_GRAINED',
default: false
}),
COMMIT_BODY: getInput({
key: 'COMMIT_BODY',
default: ''
Expand Down
3 changes: 2 additions & 1 deletion src/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const fs = require('fs')
const {
GITHUB_TOKEN,
IS_INSTALLATION_TOKEN,
IS_FINE_GRAINED,
GIT_USERNAME,
GIT_EMAIL,
TMP_DIR,
Expand Down Expand Up @@ -56,7 +57,7 @@ class Git {
// Set values to current repo
this.repo = repo
this.workingDir = path.join(TMP_DIR, repo.uniqueName)
this.gitUrl = `https://${ IS_INSTALLATION_TOKEN ? 'x-access-token:' : '' }${ GITHUB_TOKEN }@${ repo.fullName }.git`
this.gitUrl = `https://${ IS_INSTALLATION_TOKEN ? 'x-access-token:' : '' }${ IS_FINE_GRAINED ? 'oauth:' : '' }${ GITHUB_TOKEN }@${ repo.fullName }.git`

await this.clone()
await this.setIdentity()
Expand Down