Skip to content

Clean up the code when checking z/OSMF [v3] #245

Clean up the code when checking z/OSMF [v3]

Clean up the code when checking z/OSMF [v3] #245

# 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