GitHub_Actions(shedule) #30033
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: GitHub_Actions(shedule) | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "*/30 0-12,21-23 * * *" # 6時〜21時、10分ごとに動作 | |
repository_dispatch: | |
types: [GitHub_Actions(gas)] | |
env: # 環境変数から文字列(パスワードなど)を取得 | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
ACCESS_TOKEN_SECRET: ${{ secrets.ACCESS_TOKEN_SECRET }} | |
API_KEY: ${{ secrets.API_KEY }} | |
APP_ID: ${{ secrets.APP_ID }} | |
CONSUMER_KEY: ${{ secrets.CONSUMER_KEY }} | |
CONSUMER_SECRET: ${{ secrets.CONSUMER_SECRET }} | |
GOOGLE_URL: ${{ secrets.GOOGLE_URL }} | |
INSTA_ID: ${{ secrets.INSTA_ID }} | |
INSTA_TOKEN: ${{ secrets.INSTA_TOKEN }} | |
JSON: ${{ secrets.JSON }} | |
LINE_NOTIFY: ${{ secrets.LINE_NOTIFY }} | |
MISSKEY: ${{ secrets.MISSKEY }} | |
SHEET_ID: ${{ secrets.SHEET_ID }} | |
WEBHOOK: ${{ secrets.WEBHOOK }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RUN_NUMBER: ${{ github.run_number }} | |
RUN_ID: ${{ github.run_id }} | |
TZ: "Asia/Tokyo" | |
concurrency: # 同時にworkflowが実行されたらキャンセル | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 # 10分過ぎたら強制終了 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
architecture: "x64" | |
- name: Run python | |
id: results | |
run: | | |
echo "::group::pip" | |
pip install --upgrade pip | |
pip install -r ./requirements.txt | |
echo "::endgroup::" | |
python -B schedule.py | |
- name: Notify discord when job failed # ジョブが失敗したらDiscordに通知 | |
if: ${{ failure() }} | |
uses: sarisia/actions-status-discord@v1 | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.WEBHOOK_ERROR }} | |
with: | |
status: ${{ job.status }} | |
- name: Notify Slack when job failed # ジョブが失敗したらSlackに通知 | |
if: ${{ failure() }} | |
uses: rtCamp/action-slack-notify@v2.3.2 | |
env: | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_WEBHOOK: ${{ secrets.SLACK_INCOMING_WEBHOOK_URL }} | |
- name: GitHub Summary # GitHubのステップの結果をまとめる | |
run: | | |
echo -e "- #### 時刻: ${{ steps.results.outputs.TIME }}" >> $GITHUB_STEP_SUMMARY | |
echo -e "- #### ステータス: ${{ steps.results.outputs.STATUS }}" >> $GITHUB_STEP_SUMMARY | |
echo -e "- #### 現在の時間割:\n${{ steps.results.outputs.NOW }}" >> $GITHUB_STEP_SUMMARY | |
echo -e "- #### 過去の時間割:\n${{ steps.results.outputs.BEFORE }}" >> $GITHUB_STEP_SUMMARY |