Skip to content

add: github action corn sync data#5

Merged
antfu merged 6 commits into
antfu:masterfrom
yihong0618:master
Aug 19, 2020
Merged

add: github action corn sync data#5
antfu merged 6 commits into
antfu:masterfrom
yihong0618:master

Conversation

@yihong0618
Copy link
Copy Markdown
Contributor

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

@yihong0618
Copy link
Copy Markdown
Contributor Author

@antfu
Try to add feature for #4

@antfu
Copy link
Copy Markdown
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 thread .github/workflows/run_cafe_sync.yml Outdated
Comment on lines +41 to +49
- name: Push new Cafe
uses: github-actions-x/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Add new Cafe"
files: src/data.json
rebase: 'true'
name: yihong0618
email: [email protected]
Copy link
Copy Markdown
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/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Add new Cafe"
files: src/data.json
rebase: 'true'
name: yihong0618
email: [email protected]
- 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
Copy Markdown
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
Copy Markdown
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

Comment thread .github/workflows/run_cafe_sync.yml Outdated
@antfu
Copy link
Copy Markdown
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
Copy Markdown
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