diff --git a/.github/workflows/conditional.yml b/.github/workflows/conditional.yml new file mode 100644 index 000000000..196a377f3 --- /dev/null +++ b/.github/workflows/conditional.yml @@ -0,0 +1,14 @@ +name: example-workflow +on: [push] +jobs: + hello-world: + if: github.repository == 'Agnesakpa/Github-Examples' + runs-on: ubuntu-latest + steps: + - name: "Hello World" + run: echo "Hello World!" + goodbye-moon: + runs-on: ubuntu-latest + steps: + - name: "Goodbye Moon" + run: echo "Goodbye Moon!" \ No newline at end of file diff --git a/.github/workflows/custom-action.yml b/.github/workflows/custom-action.yml deleted file mode 100644 index 7a87b53f1..000000000 --- a/.github/workflows/custom-action.yml +++ /dev/null @@ -1,15 +0,0 @@ -on: [push] - -jobs: - my-job: - runs-on: ubuntu-latest - name: A job to say hello - steps: - - name: Hello world action step - id: hello - uses: omenking/barsoom@0.0.6 - with: - name: 'Brown' - # Use the output from the `hello` step - - name: Get the Output - run: echo "The time was ${{ steps.hello.outputs.greeting }}" \ No newline at end of file diff --git a/.github/workflows/webhook.yml b/.github/workflows/webhook.yml new file mode 100644 index 000000000..5c175d8da --- /dev/null +++ b/.github/workflows/webhook.yml @@ -0,0 +1,15 @@ +name: "Webhook Event example" + +on: + repository_dispatch: + types: + - webhook + +jobs: + respond-to-dispatch: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + - name: Run a script + run: 'echo "Event of type: $GITHUB_EVENT_NAME"' diff --git a/README.md b/README.md index 43fc9143d..81ca653f1 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # Github-Examples A repo containing GitHub for programmatic examples + \ No newline at end of file diff --git a/github-actions/Readme.me b/github-actions/Readme.me index 9be613aad..78c4b9b4d 100644 --- a/github-actions/Readme.me +++ b/github-actions/Readme.me @@ -10,7 +10,7 @@ echo '{"name":"mona", "greeting":"hello"}' | gh workflow run greet.yml --json ```sh curl -X POST \ -H "Accept: application/vnd.github+json" \ --H "Authorization: token {PAT} \ +-H "Authorization: token "" \ -d '{"event_type": "webhook", "client_payload": {"key": "value"} }' \ -https://api.github.com/repos/{owner}/{repo}/dispatches +https://api.github.com/repos/Agnesakpa/Github-Examples/dispatches ``` \ No newline at end of file