Skip to content

Weekly E2E Test Check #27

Weekly E2E Test Check

Weekly E2E Test Check #27

Workflow file for this run

name: Weekly E2E Test Check
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0'
jobs:
weekly-e2e-check:
if: github.repository_owner == 'alibabacloud-automation'
name: 'weekly e2e check'
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: checkout
uses: actions/checkout@v3
- name: set id
id: set-job-id
uses: ayachensiyuan/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
job-name: 'weekly e2e check'
- name: Get job id
run: |
echo "The current job id is ${{ steps.set-job-id.outputs.jobId }}"
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: weekly e2e test
run: |
objectPath="github-action/${{github.repository}}/weekly-e2e/Action-${{github.run_number}}-${{github.run_id}}-${{ steps.set-job-id.outputs.jobId }}"
echo "default branch: ${{ steps.extract_branch.outputs.branch }}"
go run scripts/curl_fc_trigger.go ${{ steps.extract_branch.outputs.branch }} ${{github.repository}} ${objectPath}
go run scripts/e2e_check.go ${objectPath}
- name: whether to upload test record
id: whether-to-upload-test-record
run: |
REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)
modules=$(curl -sL "https://terraform-fc-test-for-example-module.oss-ap-southeast-1.aliyuncs.com/testRecordReleased.json")
if echo "$modules" | jq --arg key "$REPO_NAME" -re 'has($key)' | grep -q true; then
echo "The key exists at the JSON object."
echo "::set-output name=output_value::1"
else
echo "The key does not exist at the JSON object."
echo "::set-output name=output_value::0"
fi
- name: update test record
if: steps.whether-to-upload-test-record.outputs.output_value == 1
run: |
git add TestRecord.md
cd .git
sudo chmod -R a+rwX .
sudo find . -type d -exec chmod g+s '{}' +
- name: Commit & Push changes
if: steps.whether-to-upload-test-record.outputs.output_value == 1
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
message: 'Update TestRecord'
branch: ${{ steps.extract_branch.outputs.branch }}