My Workflow
This workflow read all the images from the images folder and make a PDF and save it to the root folder and push the PDF to the repository.github Repo
Submission Category:
Wacky Wildcards
Yaml File or Link to Code
Workflow:
name: Add members to .md file
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout repo content
uses: actions/checkout@v2 # checkout the repository content to github runner
- name: setup python
uses: actions/setup-python@v2
with:
python-version: '3.7.7' # install the python version needed
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: execute py script # run sj-gobierno.py to get the latest data
run: python main.py
- name: Commit files
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "Added member"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
main.py:
from fpdf import FPDF
import os
pdf = FPDF()
for image in os.listdir("images"):
pdf.add_page()
pdf.image('images/'+image,x = None,y = None)
pdf.output(name="images.pdf",dest= "F")
print("done")
Additional Resources / Info
action demo github repo
Top comments (0)