Testing #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Post HTML | |
on: | |
issues: | |
types: | |
- opened # Trigger on new issue creation | |
- edited # Trigger on edited issue | |
jobs: | |
generate-post: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- name: Install Dependencies | |
run: pip install -r requirements.txt # If you have any dependencies | |
- name: Generate Post HTML | |
run: python scripts/generate_post.py ${{ github.event.issue.number }} "${{ github.event.issue.title }}" "${{ github.event.issue.user.login }}" "${{ github.event.issue.bodyHTML }}" | |
- name: Add new post to recents page | |
run: python scripts/add_to_recent.py ${{ github.event.issue.number }} "${{ github.event.issue.title }}" "${{ github.event.issue.user.login }}" "${{ github.event.issue.bodyHTML }}" | |
- name: Commit and Push Changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Generate HTML for issue #${{ github.event.issue.number }}" | |
git push | |
comment: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create Comment | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: "Your post going to be available after a few seconds in https://nimafanniasl.github.io/GithubForum/posts/${{ github.event.issue.number }}.html" | |
}) |