Update continue-on-error.yml #123
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: '$GITHUB_OUTPUT' | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
pre-job: | |
runs-on: ubuntu-latest | |
outputs: | |
result: ${{ steps.git.outputs.parent_commit }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get parent commit from topic branch | |
run: git rev-list --parents -n 1 @ | awk '{print $3}' | |
- name: $GITHUB_OUTPUT | |
id: git | |
run: | | |
parent_commit=$(git rev-list --parents -n 1 @ | awk '{print $3}') | |
echo "parent_commit=$parent_commit" >> $GITHUB_OUTPUT | |
- name: Output the result 1 | |
if: steps.git.outputs.parent_commit | |
run: | | |
echo "commit: ${{ steps.git.outputs.parent_commit }}" | |
- name: Output the result 2 | |
if: steps.git.outputs.parent_commit == '' | |
run: | | |
echo "commit is empty!" | |
job: | |
runs-on: ubuntu-latest | |
needs: pre-job | |
if: needs.pre-job.outputs.result | |
steps: | |
- name: Output the result 3 | |
run: | | |
echo "commit: ${{ needs.pre-job.outputs.result }}" | |
post-job: | |
runs-on: ubuntu-latest | |
needs: job | |
steps: | |
- run: echo 1 | |
- run: echo 2 | |
if: github.event_name == 'workflow_dispatch' | |
- run: echo 3 |