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

add: github action corn sync data #5

Merged
merged 6 commits into from
Aug 19, 2020
Merged

add: github action corn sync data #5

merged 6 commits into from
Aug 19, 2020

Conversation

yihong0618
Copy link
Sponsor Contributor

Please change the secret token username and email in GitHub action.

@yihong0618
Copy link
Sponsor Contributor Author

@antfu
Try to add feature for #4

@antfu
Copy link
Owner

antfu commented Aug 18, 2020

Thanks for working on this! However, I don't think committing the entire data.json is a good approach, think about just committing the head sha of the source repo would be enough (netlify will handle the fetch and build process)

Comment on lines 41 to 49
- name: Push new Cafe
uses: github-actions-x/commit@v2.6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Add new Cafe"
files: src/data.json
rebase: 'true'
name: yihong0618
email: zouzou0208@gmail.com
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Push new Cafe
uses: github-actions-x/commit@v2.6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Add new Cafe"
files: src/data.json
rebase: 'true'
name: yihong0618
email: zouzou0208@gmail.com
- uses: EndBug/add-and-commit@v4
with:
message: 'chore: update source'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

And I would suggest using this action instead :)

Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I think you are right, thanks. That will be easily. So can I create one json file only store the commit-sha on source repo if it change we trigger the action commit and netlify will do the other job?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly! I think a plain text file with the sha will do. You can run this line to get the latest sha

curl https://api.github.com/repos/ElaWorkshop/awesome-cn-cafe/branches/master --silent | grep "sha" | head -n1 > sha

@antfu
Copy link
Owner

antfu commented Aug 19, 2020

Looking great to me! Thanks for your work, merging now :)

@antfu antfu merged commit 63e1cd6 into antfu:master Aug 19, 2020
@yihong0618
Copy link
Sponsor Contributor Author

Looking great to me! Thanks for your work, merging now :)

Thank you, really learned a lot from your kind advice and repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants