Skip to content

Add pai plugin tmpl #145

Add pai plugin tmpl

Add pai plugin tmpl #145

Workflow file for this run

name: iact3-test
on:
pull_request_target:
types: [ opened, synchronize, reopened ]
jobs:
iact3Test:
runs-on: ubuntu-latest
steps:
- name: White list
id: white-list
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
white_list=($(curl -sSL -H "Authorization: token $GH_TOKEN" "https://api.github.com/repos/${{ github.repository }}/collaborators" | jq -r '.[].login'))
echo $white_list
if [[ " ${white_list[@]} " =~ " ${{ github.actor }} " ]]; then
echo "type=test" >> $GITHUB_OUTPUT
else
echo "type=validate" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v3
id: checkout
with:
fetch-depth: 0
- name: Find changed templates
id: changed-templates
run: |
git fetch origin +refs/pull/${{ github.event.pull_request.number }}/merge
git checkout -qf FETCH_HEAD
echo "changed_files=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD master) | xargs)" >> $GITHUB_OUTPUT
echo $(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD master) | xargs)
- name: Test templates
uses: aliyun/alibabacloud-ros-tool-iact3@master
with:
templates: ${{ steps.changed-templates.outputs.changed_files }}
access_key_id: ${{ secrets.TEST_ACCOUNT_KEY }}
access_key_secret: ${{ secrets.TEST_ACCOUNT_SECRET }}
type: ${{ steps.white-list.outputs.type }}
id: test-templates
if: ${{ steps.white-list.outputs.type == 'test' }}
- name: Validate templates
uses: aliyun/alibabacloud-ros-tool-iact3@master
with:
templates: ${{ steps.changed-templates.outputs.changed_files }}
access_key_id: ${{ secrets.VALIDATE_ACCOUNT_KEY }}
access_key_secret: ${{ secrets.VALIDATE_ACCOUNT_SECRET }}
type: ${{ steps.white-list.outputs.type }}
id: validate-templates
if: ${{ steps.white-list.outputs.type == 'validate' }}
- name: DingTalk Robot
if: always()
continue-on-error: true
run: |
if [[ "${{ steps.white-list.outputs.type }}" != "test" ]]; then
if [[ "${{ steps.validate-templates.outputs.status }}" = "success" ]]; then
curl -H 'Content-Type: application/json;charset=utf-8' -d '{"msgtype": "text","text": {"content": "Iact3-validate CI pass. ${{ github.event.pull_request.user.login }} PR#${{ github.event.pull_request.number }}:${{ github.event.pull_request.title }} ${{ github.event.pull_request.html_url }} "}}' ${{ secrets.DINGDING_WEBHOOK }}
else
curl -H 'Content-Type: application/json;charset=utf-8' -d '{"msgtype": "text","text": {"content": "Iact3-validate CI failed. ${{ github.event.pull_request.user.login }} PR#${{ github.event.pull_request.number }}:${{ github.event.pull_request.title }} ${{ github.event.pull_request.html_url }} "}}' ${{ secrets.DINGDING_WEBHOOK }}
fi
else
if [[ "${{ steps.test-templates.outputs.status }}" = "success" ]]; then
curl -H 'Content-Type: application/json;charset=utf-8' -d '{"msgtype": "text","text": {"content": "Iact3-test CI pass. ${{ github.event.pull_request.user.login }} PR#${{ github.event.pull_request.number }}:${{ github.event.pull_request.title }} ${{ github.event.pull_request.html_url }} "}}' ${{ secrets.DINGDING_WEBHOOK }}
else
curl -H 'Content-Type: application/json;charset=utf-8' -d '{"msgtype": "text","text": {"content": "Iact3-test CI failed. ${{ github.event.pull_request.user.login }} PR#${{ github.event.pull_request.number }}:${{ github.event.pull_request.title }} ${{ github.event.pull_request.html_url }} "}}' ${{ secrets.DINGDING_WEBHOOK }}
fi
fi