Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflow_dispatch input event name #55

Merged
merged 2 commits into from
Sep 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ on:
watch:
workflow_dispatch:
inputs:
name:
description: 'Name'
event:
description: 'event name'
default: 'workflow_dispatch'
required: true
workflow_run:
workflows: [Lint]
Expand All @@ -41,6 +42,7 @@ jobs:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACT_EVENT_NAME: ${{ inputs.event || github.event_name }}
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -73,11 +75,12 @@ jobs:
echo "${GITHUB_EVENT_CONTEXT}" > github_event.json
- name: Create act event.json
run: |
gh act "${{ github.event_name }}" -e gh_act_event_raw.json -j noop
gh act "${ACT_EVENT_NAME}" -e gh_act_event_raw.json -j noop
jq . < gh_act_event_raw.json > gh_act_event.json
- name: Diff
run: |
diff github_event.json gh_act_event.json || :
if: github.event_name == env.ACT_EVENT_NAME

noop:
runs-on: ubuntu-latest
Expand Down