Skip to content

Fetch and push schedule #3439

Fetch and push schedule

Fetch and push schedule #3439

Workflow file for this run

name: Fetch and push schedule
on:
schedule:
- cron: "10 1 * * *" # 10:10am in Japan
- cron: "10 13 * * *" # 10:10pm in Japan
jobs:
fetch_push:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3.0.2
with:
ref: actions
- name: Invoke-SplGreetingMain
shell: powershell # Requires old PowerShell because of VisualBasic assembly
run: |
. .\spl-schedule2.ps1
Invoke-SplSchelduleMain
# . .\spl-greeting.ps1
# Invoke-SplGreetingMain
- name: git commit and push
shell: powershell
run: |
git add schedule2m/*.json
git add schedule2d/*.json
# git add schedule/*.csv
git config --local user.email "${ENV:GITHUB_ACTOR}@users.noreply.github.com"
git config --local user.name "GitHub Actions"
git commit -m "actions at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')"
if ($LASTEXITCODE -eq 1) {
# Nothing to commit?
exit 0
}
# Push manually because ad-m/github-push-action is not supported on Windows runners
# Workaround for stderr and ErrorActionPreference=Stop https://stackoverflow.com/a/31559585
$old_error_action_preference = $ErrorActionPreference
try {
$ErrorActionPreference = "Continue"
git push "https://${ENV:GITHUB_ACTOR}:${ENV:TOKEN}@github.com/${ENV:GITHUB_REPOSITORY}.git" actions 2>&1
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
} finally {
$ErrorActionPreference = $old_error_action_preference
}
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}