login-onedrive-auto #697
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
# This workflow is automatically triggered and will call the reusable workflow. | |
name: login-onedrive-auto | |
on: | |
schedule: | |
- cron: 26 06 * * * # runs once a day at 06:26 UTC (14:26 SGT) | |
concurrency: | |
group: login-and-schedule | |
cancel-in-progress: false | |
jobs: | |
workflow-info: | |
runs-on: ubuntu-latest | |
# --------------------------------------------- | |
# DEPRECATED: set-output commands | |
# echo "::set-output name=foldername::$folder" | |
# echo "::set-output name=modename::$mode" | |
# FUTURE WORK: redirect to $GITHUB_OUTPUT | |
# echo "foldername=$folder" >> $GITHUB_OUTPUT | |
# echo "modename=$mode" >> $GITHUB_OUTPUT | |
# --------------------------------------------- | |
# Solution to pass variables between jobs in a workflow without using artifacts | |
# https://user-images.githubusercontent.com/6890249/181096846-f7fdc90f-8d43-4bb9-9290-fefc9ad0bd84.png | |
# by dimisjim on 11 Mar 2021 | |
# https://github.com/orgs/community/discussions/26313 | |
outputs: | |
folder: ${{ steps.getname.outputs.foldername }} | |
mode: ${{ steps.getmode.outputs.modename }} | |
steps: | |
- name: Get folder name from current workflow name | |
id: getname | |
run: | | |
IFS=- | |
read -ra Arr <<< ${{ github.workflow }} | |
folder=${Arr[1]} | |
echo "folder name is $folder" | |
echo "::set-output name=foldername::$folder" | |
- name: Is the workflow manually or automatically triggered? | |
id: getmode | |
run: | | |
IFS=- | |
read -ra Arr <<< ${{ github.workflow }} | |
mode=${Arr[2]} | |
echo "Trigger mode: $mode" | |
echo "::set-output name=modename::$mode" | |
call-workflow: | |
needs: workflow-info | |
uses: ./.github/workflows/reusable-autolog.yml | |
with: | |
folder: ${{ needs.workflow-info.outputs.folder }} | |
mode: ${{ needs.workflow-info.outputs.mode }} | |
platform-name: OneDrive | |
secrets: | |
WORKFLOW_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} | |
ONEDRIVE: ${{ secrets.ONEDRIVE }} |