Sync with TCCLI #28287
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync with TCCLI | |
on: | |
schedule: | |
- cron: '0/30 * * * *' # Every 30 minutes | |
concurrency: repo_sync | |
jobs: | |
run: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate app token for bot | |
uses: tibdex/github-app-token@v1 | |
id: generate-token | |
with: | |
app_id: ${{ secrets.BOT_APP_ID }} | |
private_key: ${{ secrets.BOT_APP_PRIVATE_KEY }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
token: ${{ steps.generate-token.outputs.token }} | |
- name: Checkout TCCLI | |
uses: actions/checkout@v3 | |
with: | |
repository: TencentCloud/tencentcloud-cli | |
path: tccli | |
- name: Extract services from TCCLI | |
run: | | |
rm -rf ./zh-CN/services/* | |
cd tccli/tccli/services | |
for file in $(find . -name "*.json") | |
do | |
cp --parents $file ../../../zh-CN/services/ | |
done | |
- name: Extract commit message | |
id: commit-message | |
working-directory: ./tccli | |
run: echo "message=TCCLI $(git log -1 --pretty=%B | head -n 1)" >> $GITHUB_OUTPUT | |
- name: Import bot's GPG key for signing commits | |
id: import-gpg | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }} | |
git_config_global: true | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: Commit and push | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: ./zh-CN | |
author_name: ${{ steps.import-gpg.outputs.name }} | |
author_email: ${{ steps.import-gpg.outputs.email }} | |
message: ${{ steps.commit-message.outputs.message }} | |
push: true |