From 1e7944cea47a739452f003c8da843159e7260cdf Mon Sep 17 00:00:00 2001 From: nikunjpurohit Date: Tue, 4 Jun 2024 01:20:53 +0530 Subject: [PATCH 1/7] asd --- .github/workflows/webhook.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/webhook.yml diff --git a/.github/workflows/webhook.yml b/.github/workflows/webhook.yml new file mode 100644 index 000000000..581366668 --- /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" From 0dd1b4e8975cb1eeb2876957588530dd8db3f4aa Mon Sep 17 00:00:00 2001 From: nikunjpurohit Date: Wed, 5 Jun 2024 15:53:25 +0530 Subject: [PATCH 2/7] conditional_push --- .github/workflows/conditional.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/conditional.yml diff --git a/.github/workflows/conditional.yml b/.github/workflows/conditional.yml new file mode 100644 index 000000000..3fc2d6a6f --- /dev/null +++ b/.github/workflows/conditional.yml @@ -0,0 +1,16 @@ +name: example-workflow +on: [push] + +jobs: + hello_world: + if: github.repository =='octo-org/oct-repo-prod' + 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" + From d7d7ec9351a8c6e5f3fce3ab334c3a0ab280edc1 Mon Sep 17 00:00:00 2001 From: nikunjpurohit Date: Wed, 5 Jun 2024 16:50:42 +0530 Subject: [PATCH 3/7] add variabel --- .github/workflows/conditional.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conditional.yml b/.github/workflows/conditional.yml index 3fc2d6a6f..8cf4b992c 100644 --- a/.github/workflows/conditional.yml +++ b/.github/workflows/conditional.yml @@ -12,5 +12,5 @@ jobs: runs-on: ubuntu-latest steps: - name: "Goodbye Moon" - run: echo "Goodbye Moon" + run: echo "Goodbye Moon $github.repository" From baee03b2be626b7346cd4810ee600b74a7dd5dcf Mon Sep 17 00:00:00 2001 From: nikunjpurohit Date: Wed, 5 Jun 2024 16:53:23 +0530 Subject: [PATCH 4/7] add braces --- .github/workflows/conditional.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conditional.yml b/.github/workflows/conditional.yml index 8cf4b992c..133e5ed72 100644 --- a/.github/workflows/conditional.yml +++ b/.github/workflows/conditional.yml @@ -12,5 +12,5 @@ jobs: runs-on: ubuntu-latest steps: - name: "Goodbye Moon" - run: echo "Goodbye Moon $github.repository" + run: echo "Goodbye Moon ${{github.repository}}" From 111d947de2fa10274264e5bd0346170040927283 Mon Sep 17 00:00:00 2001 From: nikunjpurohit Date: Wed, 5 Jun 2024 16:59:43 +0530 Subject: [PATCH 5/7] expressions _added --- .github/workflows/custom-action.yml | 15 ------------ .github/workflows/webhook.yml | 15 ------------ git-crash-course/expressions.yml | 37 +++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 30 deletions(-) delete mode 100644 .github/workflows/custom-action.yml delete mode 100644 .github/workflows/webhook.yml create mode 100644 git-crash-course/expressions.yml 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 deleted file mode 100644 index 581366668..000000000 --- a/.github/workflows/webhook.yml +++ /dev/null @@ -1,15 +0,0 @@ -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/git-crash-course/expressions.yml b/git-crash-course/expressions.yml new file mode 100644 index 000000000..60d301062 --- /dev/null +++ b/git-crash-course/expressions.yml @@ -0,0 +1,37 @@ +name: Expression Functions Demo + +on: + push: + branches: + - main + issues: + types: [opened, labeled] + +jobs: + expression-functions: + runs-on: ubuntu-latest + steps: + - name: Check if string contains substring + if: contains('Hello world', 'llo') + run: echo "The string contains the substring." + - name: Check if string starts with + if: startsWith('Hello world', 'He') + run: echo "The string starts with 'He'." + - name: Check if string ends with + if: endsWith('Hello world', 'ld') + run: echo "The string ends with 'ld'." + - name: Format and echo string + run: echo ${{ format('Hello {0} {1} {2}', 'Mona', 'the', 'Octocat') }} + - name: Join issue labels + if: github.event_name == 'issues' + run: echo "Issue labels: ${{ join(github.event.issue.labels.*.name, ', ') }}" + - name: Convert job context to JSON + run: echo "Job context in JSON: ${{ toJSON(github.job) }}" + - name: Parse JSON string + run: echo "Parsed JSON: ${{ fromJSON('{"hello":"world"}').hello }}" + - name: Hash files + run: echo "Hash of files: ${{ hashFiles('**/package-lock.json', '**/Gemfile.lock') }} + - name: The job has succeeded + if: ${{ success() }} + - name: The job has failed + if: ${{ failure() }} \ No newline at end of file From 51e0a236444cd4f1e3018b9a7c3144cf9f5f1434 Mon Sep 17 00:00:00 2001 From: nikunjpurohit Date: Wed, 5 Jun 2024 19:03:52 +0530 Subject: [PATCH 6/7] token --- .github/workflows/token.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/token.yml diff --git a/.github/workflows/token.yml b/.github/workflows/token.yml new file mode 100644 index 000000000..0c7f6e8a0 --- /dev/null +++ b/.github/workflows/token.yml @@ -0,0 +1,15 @@ +name: Open new issue +on: workflow_dispatch + +jobs: + open-issue: + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + steps: + - run: | + gh issue --repo ${{ github.repository }} \ + create --title "Issue title" --body "Issue body" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From d83b463321b8ea7f3985e1c0035e627df41b4887 Mon Sep 17 00:00:00 2001 From: nikunjpurohit Date: Wed, 5 Jun 2024 19:05:11 +0530 Subject: [PATCH 7/7] push --- .github/workflows/token.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/token.yml b/.github/workflows/token.yml index 0c7f6e8a0..33d5a178a 100644 --- a/.github/workflows/token.yml +++ b/.github/workflows/token.yml @@ -1,5 +1,5 @@ name: Open new issue -on: workflow_dispatch +on: ['push'] jobs: open-issue: