Skip to content
Open
52 changes: 51 additions & 1 deletion .github/workflows/blank.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,29 @@ on:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
update-internal:
description: "update internal source code or not"
required: true
default: "false"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
info:
runs-on: ubuntu-latest
outputs:
is_rerun_failed: ${{ steps.set-rerun.outputs.is_rerun_failed }}
steps:
- id: set-rerun
name: get is rerun
run: |
echo run this job means run all jobs!
echo "is_rerun_failed=true" >> "$GITHUB_OUTPUT"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: info

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -28,9 +44,43 @@ jobs:
# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world!

- name: Add comment via REST API
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -X POST https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
-d '{
"body": "🚀 Build succeeded!\n\nPreview URL: https://preview.yoursite.com/pr-${{ github.event.pull_request.number }}"
}'
# Runs a set of commands using the runners shell
- name: Run a multi-line script
env:
is_rerun_failed: ${{ needs.info.outputs.is_rerun_failed }}
run: |
echo Add other actions to build,
echo test, and deploy your project.
echo "Event action: ${{ github.event.action }}"
echo "Event name: ${{ github.event_name }}"
echo "Event action: ${{ github.event.action }}"
echo "Workflow run ID: ${{ github.run_id }}"
echo "Run attempt: ${{ github.run_attempt }}"
echo "Workflow: ${{ github.workflow }}"
echo "Run number: ${{ github.run_number }}"
echo "is_rerun_failed: $is_rerun_failed"
if [ "${{ needs.info.result }}" = "skipped" ]; then
echo "⚠️ prepare job was skipped, not executed."
exit 1
elif [ "${{ needs.info.result }}" = "success" ]; then
echo "✅ prepare job executed successfully."
else
echo "❌ prepare job failed."
exit 1
fi

- name: Run a one-line script
run: |
echo Hello, world!
sh ./test.sh

10 changes: 5 additions & 5 deletions .github/workflows/simple-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
#push:
# branches: [ "main" ]
#pull_request:
# branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -42,4 +42,4 @@ jobs:
# Runs get CI result
- name: Get CI result
run: |
./get-CI-result.sh "${{ github.sha }}" "${{ secrets.CI_SECRET }}"
./get-CI-result.sh "${{ github.sha }}" "${{ secrets.CI_SECRET }}"
Loading