Skip to content

Commit 9c8dfd0

Browse files
committed
autoSync by Github Action
1 parent c0332f4 commit 9c8dfd0

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

.github/workflows/weekly_e2e.yml

+26-12
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,29 @@ jobs:
3333
echo "default branch: ${{ steps.extract_branch.outputs.branch }}"
3434
go run scripts/curl_fc_trigger.go ${{ steps.extract_branch.outputs.branch }} ${{github.repository}} ${objectPath}
3535
go run scripts/e2e_check.go ${objectPath}
36-
# - name: update test record
37-
# run: |
38-
# git add TestRecord.md
39-
# cd .git
40-
# sudo chmod -R a+rwX .
41-
# sudo find . -type d -exec chmod g+s '{}' +
42-
# - name: Commit & Push changes
43-
# uses: actions-js/push@master
44-
# with:
45-
# github_token: ${{ secrets.GITHUB_TOKEN }}
46-
# message: 'Update TestRecord'
47-
# branch: main
36+
- name: whether to upload test record
37+
id: whether-to-upload-test-record
38+
run: |
39+
REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)
40+
modules=$(curl -sL "https://terraform-fc-test-for-example-module.oss-ap-southeast-1.aliyuncs.com/testRecordReleased.json")
41+
if echo "$modules" | jq --arg key "$REPO_NAME" -re 'has($key)' | grep -q true; then
42+
echo "The key exists at the JSON object."
43+
echo "::set-output name=output_value::1"
44+
else
45+
echo "The key does not exist at the JSON object."
46+
echo "::set-output name=output_value::0"
47+
fi
48+
- name: update test record
49+
if: steps.whether-to-upload-test-record.outputs.output_value == 1
50+
run: |
51+
git add TestRecord.md
52+
cd .git
53+
sudo chmod -R a+rwX .
54+
sudo find . -type d -exec chmod g+s '{}' +
55+
- name: Commit & Push changes
56+
if: steps.whether-to-upload-test-record.outputs.output_value == 1
57+
uses: actions-js/push@master
58+
with:
59+
github_token: ${{ secrets.GITHUB_TOKEN }}
60+
message: 'Update TestRecord'
61+
branch: ${{ steps.extract_branch.outputs.branch }}

0 commit comments

Comments
 (0)