Only cancel in-progress jobs or runs for the current workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Dump GitHub context
run: echo "$GITHUB_CONTEXT"
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
Dispatch Event Call
curl -L -X POST https://api.github.com/repos/nntrn/save/dispatches \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN"\
-H "X-GitHub-Api-Version: 2022-11-28" \
-d '{"event_type":"on-greeting","client_payload":{"greeting":"what is up","n":10}}'
# default values to use
env:
greeting: 'Hello'
n: 1
on:
push:
workflow_dispatch:
inputs:
n:
description: Magic number
type: number
default: 0
required: false
greeting:
description: A greeting message
type: string
default: ''
required: false
schedule:
# UTC time
- cron: '0 7 * * *'
repository_dispatch:
types: [on-greeting]
jobs:
greet:
runs-on: ubuntu-20.04
steps:
- name: Greeting
run: |
echo "${{ github.event.inputs.greeting || github.event.client_payload.greeting || env.n }} \
to you ${{ github.event.inputs.n || github.event.client_payload.n || env.n }} times"
REST API create issue from commit
name: Create issue on commit
on: [ push ]
jobs:
create_issue:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Create issue using REST API
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/issues \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"title": "Automated issue for commit: ${{ github.sha }}",
"body": "This issue was automatically created by the GitHub Action workflow **${{ github.workflow }}**. \n\n The commit hash was: _${{ github.sha }}_."
}' \
--fail