-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (62 loc) · 2.24 KB
/
context.yml
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: context
on:
pull_request:
types:
- opened
- synchronize # default
- ready_for_review
- labeled
- unlabeled
- closed
workflow_dispatch:
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: echo toJson(github)
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: github.event.action
env:
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
run: |
echo "- github.event.action : ${{ github.event.action }}"
{
echo "- github.event.action : ${{ github.event.action }}"
echo "- github.ref_name : ${{ github.ref_name }}"
echo "- github.event.pull_request.head.ref : $PR_HEAD_REF"
} >> "$GITHUB_STEP_SUMMARY"
label:
runs-on: ubuntu-latest
env:
SKIP: 'FALSE'
steps:
- if: ${{ github.event.action == 'labeled' && !contains(toJson('["test", "build"]'), github.event.label.name) }}
id: skip
name: ignore unrelavant labels
run: |
echo "SKIP=TRUE" >> "$GITHUB_ENV"
echo "- github.event.action : ${{ github.event.action }}" >> "$GITHUB_STEP_SUMMARY"
echo "- github.event.label.name : ${{ github.event.label.name }}" >> "$GITHUB_STEP_SUMMARY"
- name: Dump GitHub context
if: ${{ env.SKIP != 'TRUE' }}
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
echo "$GITHUB_CONTEXT"
echo "- github.event.action : ${{ github.event.action }}" >> "$GITHUB_STEP_SUMMARY"
- if: ${{ contains( github.event.pull_request.labels.*.name, 'test') }}
name: check if a pr has test label
run: |
echo "- github.event.pull_request.labels has 'test'" >> "$GITHUB_STEP_SUMMARY"
- name: write sha as comment
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `event: ${{ github.event_name }}\n- github.event.pull_request.head.sha: ${{ github.event.pull_request.head.sha }}\n - github.sha: ${{ github.sha }}`
})