This repository contains a public Custom Docker Container GitHub Action that:
- To let you update your
README.mdabout your recent activities on: - To demostrate:
- How to create a Custom Docker Container GitHub Action
- It can be done in .NET6 and C#
- Instead of using other's action like gautamkrishnar/blog-post-workflow, make your own.
Note that there is nothing wrong to use other's actions to speed up your work and objective. (In fact gautamkrishnar/blog-post-workflow is a great one). However, although we always strive to not "re-invent the wheels", as a developer you should understand how it works as well. If you want to promote yourself with a stunning profile, what will better than writing some code by yourself? An account contains only other's code is not a good idea for building up a professional developer image IMHO.
The code also written in a way that is easy to extend for adding more blog post source, and easy to configure.
| Name | Default | Order |
|---|---|---|
| file-to-update | README.md | 1 |
| medium-user-id | unknown | 2 |
| stackoverflow-user-id | unknown | 3 |
<!-- MEDIUM:START -->
Text will be replaced.
<!-- MEDIUM:END -->
<!-- STACKOVERFLOW:START -->
Text will be replaced.
<!-- STACKOVERFLOW:END -->Note: You should use GitHub repository/environment secrets for your user IDs
- name: Load blog posts and update README.md
id: update-readme
uses: ferrywlto/update-readme-action-csharp@v1
with:
medium-user-id: ${{ secrets.MEDIUM_USER_ID }}
stackoverflow-user-id: ${{ secrets.STACKOVERFLOW_USER_ID }}Supply file-to-update argument if the file your want to update named something else:
- uses: ferrywlto/update-readme-action-csharp@v1
with:
file-to-update: MyFile.txt
medium-user-id: ${{ secrets.MEDIUM_USER_ID }}
stackoverflow-user-id: ${{ secrets.STACKOVERFLOW_USER_ID }}Don't like "START", "END", or you want pattern other than <!-- SOMETHING:START -->?
For example, fork me and add this in Program.cs:
ContentReplacer.SetMarkerPattern("<!-- #{0}#{1}# -->", "BEGIN", "FINISH");Then the action will look for <!-- #MEDIUM#BEGIN# --> and <!-- #MEDIUM#END# --> to insert content.
IndexOutOfRangeException
Make sure your README.md contains required comment tags.
Let say we want to add links from other source (e.g. dev.to) as well.
- Create a content loader class that implements
IContentLoader - Add new entry in
ContentLoaderFactory.GetContentLoader() - Add new marker tags into your
README.md