LironHazan / actions-fe-guild-session

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DIY it's easy - GHA in Typescript


As part of js fatigue sessions aimed for the FE/FS Guild (@SentinelOne)


Agenda:

  • Briefly go over on core concepts
  • Briefly go over types of custom actions
    • Example of a "composite" action
  • Using actions/github-script@v6
  • Creating own action in typescript!

Composite

Example of the composite action is located under .github/actions/composite-example and used by test_composite_action.yml

Inline script example

- name: Greet
  uses: actions/github-script@v6
  with:
    script: |
      const prNumber = context.payload.pull_request.number;
      const actor = context.actor;
      const comment = `
      👋 Hello @${actor}! 
          What a nice code you contributed!
      `;
      await github.rest.issues.createComment({
        owner: context.repo.owner,
        repo: context.repo.repo,
        issue_number: prNumber,
        body: comment
      });

Creating own action in typescript

Example of the custom action use .github/workflow/use_custom_ts_action.yml

How to use in other repos:

      - name: From action version
        uses: LironHazan/actions-fe-guild-session@v1.0.1
        with:
          ghToken: ${{ secrets.GITHUB_TOKEN }}

About


Languages

Language:TypeScript 100.0%