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/dependent-jobs.yml b/.github/workflows/dependent-jobs.yml new file mode 100644 index 000000000..6c6a1752a --- /dev/null +++ b/.github/workflows/dependent-jobs.yml @@ -0,0 +1,31 @@ +name: Build, Test, and Deploy Workflow + +on: + push: + branches: + - main + +jobs: + deploy: + needs: [build, test] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Deploy application + run: echo "Deploying to production..." + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Build application + run: echo "Building the application..." + test: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Test application + run: echo "Running tests..." \ No newline at end of file diff --git a/github-actions/templates/context.yml b/github-actions/templates/context.yml new file mode 100644 index 000000000..5b115e0bf --- /dev/null +++ b/github-actions/templates/context.yml @@ -0,0 +1,45 @@ +name: Context Examples +on: [push] +jobs: + my-context: + runs-on: ubuntu-latest + steps: + - name: "Display job context" + run: | + echo "Job context in JSON: ${{ toJSON(github.job) }}" + echo "Job ref in JSON: ${{ toJSON(github.ref) }}" + echo "Job sha in JSON: ${{ toJSON(github.sha) }}" + - name: "Display runner context" + run: | + echo "Runner OS: ${{ runner.os }}" + echo "Runner Temp Directory: ${{ runner.temp }}" + echo "Runner Tool Cache Directory: ${{ runner.tool_cache }}" + - name: "Display event context" + run: | + echo "Event name: ${{ github.event_name }}" + echo "Event action (if applicable): ${{ github.event.action || 'N/A' }}" + echo "Event repository name: ${{ github.event.repository.name }}" + echo "Event sender login: ${{ github.event.sender.login }}" + - name: "Display workflow context" + run: | + echo "Workflow name: ${{ github.workflow }}" + echo "Workflow run ID: ${{ github.run_id }}" + echo "Workflow run number: ${{ github.run_number }}" + echo "Workflow actor: ${{ github.actor }}" + - name: "Display repository context" + run: | + echo "Repository name: ${{ github.repository }}" + echo "Repository owner: ${{ github.repository_owner }}" + echo "Default branch: ${{ github.ref_name || 'N/A' }}" + - name: "Display commit context" + run: | + echo "Commit SHA: ${{ github.sha }}" + echo "Commit message: ${{ github.event.head_commit.message || 'N/A' }}" + echo "Commit author name: ${{ github.event.head_commit.author.name || 'N/A' }}" + - name: "Set and display environment variable" + run: | + echo "Setting environment variable MY_VAR to 'HelloWorld'" + echo "MY_VAR=HelloWorld" >> $GITHUB_ENV + - name: "Display the environment variable" + run: | + echo "The value of MY_VAR is $MY_VAR" \ No newline at end of file diff --git a/github-actions/templates/greetings copy.yml b/github-actions/templates/greetings copy.yml new file mode 100644 index 000000000..46774343e --- /dev/null +++ b/github-actions/templates/greetings copy.yml @@ -0,0 +1,16 @@ +name: Greetings + +on: [pull_request_target, issues] + +jobs: + greeting: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: "Message that will be displayed on users' first issue" + pr-message: "Message that will be displayed on users' first pull request" diff --git a/github-actions/templates/worflow-commands.yml b/github-actions/templates/worflow-commands.yml new file mode 100644 index 000000000..880c2028d --- /dev/null +++ b/github-actions/templates/worflow-commands.yml @@ -0,0 +1,20 @@ +name: "workflow for group message" +on: [push] +jobs: + group-message: + runs-on: ubuntu-latest + steps: + - name: "Group message" + run: | + echo "::group::This is a group message example." + echo "This is a line inside the group." + echo "Job context in JSON: ${{ toJSON(github.job) }}" + echo "Job ref in JSON: ${{ toJSON(github.ref) }}" + echo "Job sha in JSON: ${{ toJSON(github.sha) }}" + echo "Another line inside the group." + echo "You can collapse and expand this section in the logs." + echo "::endgroup::" + - name: "Set environment variable" + run: echo "NAME=GTS" >> $GITHUB_ENV + - name: "Display environment variable" + run: echo "The value of NAME is $NAME" \ No newline at end of file