Skip to content

[BUG] Creating PR deploy the data #2073

[BUG] Creating PR deploy the data

[BUG] Creating PR deploy the data #2073

Workflow file for this run

name: Testimonial
on:
workflow_dispatch:
issues:
types: [opened, edited]
concurrency:
group: "main-branch"
jobs:
create-testimonial:
if: contains(github.event.issue.labels.*.name, 'testimonial')
runs-on: ubuntu-latest
name: Create Testimonial
steps:
# Create a temporary, uniquely named branch to push release info to
- name: create temporary branch
uses: peterjgrainger/[email protected]
id: create-branch
with:
branch: "testimonial-from-${{ github.sha }}"
sha: "${{ github.sha }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
# fetch branches and switch to the temporary branch
- name: switch to new branch
run: git fetch --all && git checkout --track origin/testimonial-from-${{ github.sha }}
# parse issue
- uses: stefanbuck/github-issue-parser@v3
id: issue-parser
with:
template-path: .github/ISSUE_TEMPLATE/testimonial.yml
issue-body: ${{ github.event.issue.body }}
- name: current date
id: date
uses: Kaven-Universe/github-action-current-date-time@v1
with:
format: "YYYY-MM-DD"
- name: create folder
run: |
mkdir -p data/${{ steps.issue-parser.outputs.issueparser_name }}/testimonials
- name: create json file
run: |
node .github/scripts/testimonial.mjs
env:
FILE_NAME: "data/${{ steps.issue-parser.outputs.issueparser_name }}/testimonials/${{ github.actor }}.json"
DATA_TITLE: ${{ steps.issue-parser.outputs.issueparser_title }}
DATA_DESCRIPTION: ${{ steps.issue-parser.outputs.issueparser_description}}
DATA_DATE: ${{ steps.date.outputs.time }}
- name: validate JSON
run: jq . "data/${{ steps.issue-parser.outputs.issueparser_name }}/testimonials/${{ github.actor }}.json"
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Testimonial for '${{ steps.issue-parser.outputs.issueparser_name }}' by '${{ github.actor }}'"
# create PR using GitHub CLI
- name: create PR with testimonial info
id: create-pr
run: gh pr create --base main --head testimonial-from-${{ github.sha }} --title 'Merge testimonial into main' --body 'Created by Github action'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# merge PR using GitHub CLI
- name: merge PR with testimonial info
id: merge-pr
run: gh pr merge --admin --merge --subject 'Merge testimonial info' --delete-branch
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# close issue
- name: Close Issue
uses: YiiGuxing/[email protected]
with:
comment: |
Testimonial added for @${{ steps.issue-parser.outputs.issueparser_name }}. Thank you for your contribution! @${{ steps.issue-parser.outputs.issueparser_name }} if you wish to add it your BioDrop profile please follow the instructions in the docs for json https://biodrop.io/docs/how-to-guides/testimonials-json or for forms https://biodrop.io/docs/how-to-guides/testimonials-forms