MSO_E5_Dev_AR #2301
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
#Automatic call to the API to keep alive, encrypted version | |
name: MSO_E5_Dev_AR | |
on: | |
#release: | |
# types: [published] | |
#push: | |
# tags: | |
# - 'v*' | |
# branches: | |
# - master | |
schedule: | |
- cron: "36 */4 * * *" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: (github.event.repository.owner.id == github.event.sender.id) || ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} # Self-ordered start | |
#if: github.event.repository.owner.id == github.event.sender.id # Self-ordered start | |
name: Build and call API | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: true # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. | |
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | |
- name: Set up Python #Install python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
check-latest: true | |
- name: Install requests #Installation requests | |
run: | | |
pip install requests | |
- name: Test Api Inst1 | |
id: api-inst1 | |
env: | |
CONFIG_APPID: ${{ secrets.CONFIG_APPID }} # secrets_id prepare | |
CONFIG_SECRET: ${{ secrets.CONFIG_SECRET }} # secrets_key prepare | |
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} # refresh_token prepare | |
run: | | |
echo `date +"%Y-%m-%d %H:%M:%S"` begin > time.log | |
python3 main.py | |
- name: Update Token | |
uses: gliech/create-github-secret-action@v1 | |
with: | |
name: REFRESH_TOKEN | |
value: ${{ steps.api-inst1.outputs.OD_REFRESH_TOKEN }} | |
pa_token: ${{ secrets.GH_PA_TOKEN }} | |
- name: Test Api Inst2 # For second Tenancy | |
id: api-inst2 | |
env: | |
CONFIG_APPID: ${{ secrets.CONFIG_APPID2 }} # secrets_id prepare | |
CONFIG_SECRET: ${{ secrets.CONFIG_SECRET2 }} # secrets_key prepare | |
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN2 }} # refresh_token prepare | |
run: | | |
python3 main.py | |
- name: Update Token | |
uses: gliech/create-github-secret-action@v1 | |
with: | |
name: REFRESH_TOKEN2 | |
value: ${{ steps.api-inst2.outputs.OD_REFRESH_TOKEN }} | |
pa_token: ${{ secrets.GH_PA_TOKEN }} | |
- name: Commit #Upload new timestamp to the repository | |
run: | | |
git config --global user.email [email protected] | |
git config --global user.name SB | |
git add . | |
git commit -m "Update new refresh token with MSO_E5_Dev_AR" -a | |
- name: Push changes | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
#force_with_lease: true |