-
Notifications
You must be signed in to change notification settings - Fork 51
63 lines (55 loc) · 2.05 KB
/
cicd-comment-trigger.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
# Triggers when comments are made on issues/PRs, runs when '/ci' is added to a pull request.
name: Zowe CICD Issue Trigger
permissions:
issues: write
pull-requests: write
contents: write
on:
issue_comment:
types: [created, edited]
jobs:
pr-comment-check:
name: 'PR Comment Check'
runs-on: ubuntu-latest
outputs:
issue_run_ci: ${{ steps.check-comment.outputs.issue_run_ci }}
steps:
- name: Check for a comment triggering a build
id: check-comment
run: |
echo "issue_run_ci=false" >> $GITHUB_OUTPUT
if [[ ! -z "${{ github.event.issue.pull_request }}" && ${{ github.event_name == 'issue_comment' }} && "${{ github.event.comment.body }}" = '/ci' ]]; then
echo "issue_run_ci=true" >> $GITHUB_OUTPUT
fi
get-pr-branch:
name: 'Get PR Branch'
runs-on: ubuntu-latest
outputs:
pr_branch_name: ${{ steps.get-pr-name.outputs.pr_branch_name }}
steps:
- name: Find PR Branch Name
id: get-pr-name
run: |
gh config set pager cat
PR_BRANCH=$(gh pr view ${{ github.event.issue.number }} -R zowe/zowe-install-packaging --json headRefName -q .headRefName)
echo "pr_branch_name=$PR_BRANCH" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ github.token }}
trigger-ci:
name: 'Trigger Build'
runs-on: ubuntu-latest
needs: [pr-comment-check, get-pr-branch]
if: ${{ needs.pr-comment-check.outputs.issue_run_ci == 'true' }}
steps:
- name: 'Trigger Build workflow'
uses: zowe-actions/shared-actions/workflow-remote-call-wait@main
with:
github-token: ${{ secrets.ZOWE_ROBOT_TOKEN }}
owner: zowe
repo: zowe-install-packaging
workflow-filename: build-packaging.yml
branch-name: ${{ needs.get-pr-branch.outputs.pr_branch_name }}
poll-frequency: 3
inputs-json-string: '{"ORIGIN_ISSUE_TRIGGER":"true", "KEEP_TEMP_PAX_FOLDER":"false"}'
env:
DEBUG: zowe-actions:shared-actions:workflow-remote-call-wait