-
-
Notifications
You must be signed in to change notification settings - Fork 122
Read access token from config #135
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
Conversation
3dace4b
to
6b3a9e6
Compare
Implementation and test cases updated, please check. |
6b3a9e6
to
c0209bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding coverge
to .gitignore
?
c0209bf
to
5e647a8
Compare
Sorry about that, I deleted |
Changes requested have been pushed. And I think tokens for different repos are hardly the same, and a token config at top level applied to all repoes is about to cause deployment failure. So I move the token config inside each repo's setting. To achive that, Structured repo setting is supported in this branch, to avoid complicated string parsing. Please check README file for detail. |
83f053e
to
8855828
Compare
8855828
to
05b3b9b
Compare
Is it possible to get this merged in? |
@gigaSproule I have approved this Pull Request, but since this Pull Request bring up a major change and we should take careful of it. |
I totally agree, just there wasn't an update from 20 days ago after an approval. I thought that maybe this just got missed off someone's radar. |
@gigaSproule You can make use of this feature from my forked repo before this merge request is accepted, just replace the installation by npm install https://github.com/xiaozhikang0916/hexo-deployer-git.git --save It is working fine in my blog repo with github action, check the configuration for detail. |
@xiaozhikang0916 I'm sure I'm doing something wrong, but it's not working. I tried adding Edit: Just been debugging and the npm install you sent was missing the branch, but with that included, it only works with the repo object, not string, which is what I'm guessing is the expected behaviour. |
@gigaSproule Sorry about my mistaken, I thought everything in my feature branch has been merged into my And yes, token config only works with a repo object, but not string. Because it will take grate effort to parse token and/or branch name from a string which is not worthy, and in my opinion, declared every thing you need in a field clearly will be easier to maintain. |
README.md
Outdated
ignore_pattern: | ||
[folder]: regexp # or you could specify the ignore_pattern under a certain directory | ||
|
||
# keys inside repo do not matter, and can be omitted for single repo with token: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which keys can be omitted? repo.url
& repo.token
? Can you give an example config for single repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means the name of repo.
For multiple repos config, we have:
deploy:
repo:
repo_A: <repository url>[,branch]
repo_B:
url: <repository url>
branch: [branch]
token: [$ENV_TOKEN]
But for config with single repo, which I think should be the most situation, we will get something like:
deploy:
repo:
my_repo:
url: <repository url>
branch: [branch]
token: [$ENV_TOKEN]
In this case, name of repo might be superfluous so we can omit it. Example config for single repo is followed in the next 4 lines.
The description might be misleading so I updated it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean for a single repo, my_repo:
key can be omitted, like
deploy:
repo:
url: <repository url>
branch: [branch]
token: [$ENV_TOKEN]
it only works with the repo object, not string
so the following wouldn't work?
deploy:
repo: <repository url>[,branch]
I'm assuming the following also wouldn't work?
deploy:
repo:
my_repo: <repository url>[,branch]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both will work as they are kinds of existing config.
For the first case, check test case 'single repo, branch after url'.
For the following one, the omit of name is optional and it's fine to keep it. This case is updated to the unit test.
Is there any breaking change? Does existing config still work? Judging from the readme, I don't think there is any breaking change? |
@curbengh No breaking change here, and existing config is still working, which is guranteed by the unit test. All unit test cases from |
I would like to deploy my blog page from some CI servers, but found that it's dangerous to store my account info in my hexo config file.
But some of the ci servers can securely store such info in environment variables, and github is accessible by Personal access token, so I managed to provide the token either from
args.token
field as plain-text, or a env-var, whose name is from config'stoken
field with a prefix$
.Note that this feature is only functional only if the repo's scheme is
http
orhttps
, but the test case provide a fake repo from disk. So I only add a stub test case. Do you have any idea to test this new feature?