-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Expand file tree
/
Copy pathcontext.yml
More file actions
45 lines (45 loc) · 2.18 KB
/
Copy pathcontext.yml
File metadata and controls
45 lines (45 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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"