I own a site, this site will use a python script to generate.
DETAILED python is generated script reads csv file in the directory, each row of data will be parsed into fixed format, and generates html files Finally the modified file to automatically push github
Of course, all of the above steps are implemented automation, summarized as follows:
- My local modifications csv file, then push to github
- I push operation triggers a realization set a good action
action code is set as follows:
name: Python application
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout actions
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Update paper list
run: |
cd paper_infos
python generate_tables.py
- name: commit
run: |
git config --global user.email [email protected]
git config --global user.name marsggbo
git add .
git commit -m "update" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Code explanation:
- The first line
name
: Whatever can be set, is your action name on
: Trigger condition, I set here ispush
the event to start operationjobs
: Github Actions hierarchy is this: workflow / jobs / steps / action. Note to distinguish action and Github Actions in the Actions area, the two are different concepts, action it means the lowest level of action, Actions is the name of a function to Github we provide it.steps
: And similar jobs. You can see a number of steps by the step, each step can be setname
uses
: This indication someone else pre-set Actions, such as the code I use to python, so I usedactions/setup-python@v1
to set the python environment, I do not set myself up.run
: A specific line of code to run what commands- It can be seen in my name for the first
Update paper list
run the python script - After github folder did commit
- Finally, the use of someone else's actions the updated code push to github again
- It can be seen in my name for the first
- The last line
github_token
should be noted that this long pause before I get to understand this fact, it is equivalent to your password. This setting is to set up access to your personal page (ie, Settings, not a warehouse Settings), selectDeveloper settings
>Personal access tokens
>Generate new token
, is set to nameGITHUB_TOKEN
, and then check therepo
,admin:repo_hook
,workflow
and other options, and finally clickGenerate token
can be.
See specific code marsggbo / automl_a_survey_of_state_of_the_art