This commit is contained in:
NianBroken
2024-02-14 17:05:49 +08:00 Unverified
parent 08aad1bf5e
commit b2d5ba7d94
3 changed files with 34 additions and 6 deletions
+9 -6
View File
@@ -19,9 +19,14 @@ on:
jobs: jobs:
SyncFork: SyncFork:
name: SyncFork name: SyncFork
# 在最新版的Ubuntu系统上运行 # 在最新版的Ubuntu系统上运行
runs-on: ubuntu-latest runs-on: ubuntu-latest
# 定义作业SyncFork的输出变量
outputs:
MAIN_YML_FILES_INCONSISTENT: ${{ steps.compare_main_yml_files.outputs.MAIN_YML_FILES_INCONSISTENT }}
steps: steps:
# 使用GitHub Actions提供的动作来检出代码库 # 使用GitHub Actions提供的动作来检出代码库
- name: Checkout Repository - name: Checkout Repository
@@ -44,13 +49,14 @@ jobs:
# 对比当前分支的main.yml文件与上游分支的main.yml文件是否一致 # 对比当前分支的main.yml文件与上游分支的main.yml文件是否一致
- name: Compare main.yml files - name: Compare main.yml files
id: compare_main_yml_files
run: | run: |
if cmp -s .github/workflows/main.yml <(git show upstream/main:.github/workflows/main.yml); then if cmp -s .github/workflows/main.yml <(git show upstream/main:.github/workflows/main.yml); then
echo "main.yml file is consistent" echo "main.yml file is consistent"
echo "MAIN_YML_FILES_INCONSISTENT=False" >> $GITHUB_ENV echo "::set-output name=MAIN_YML_FILES_INCONSISTENT::False"
else else
echo "main.yml file is inconsistent" echo "main.yml file is inconsistent"
echo "MAIN_YML_FILES_INCONSISTENT=True" >> $GITHUB_ENV echo "::set-output name=MAIN_YML_FILES_INCONSISTENT::True"
fi fi
# 定义备份和还原的文件后缀列表 # 定义备份和还原的文件后缀列表
@@ -88,9 +94,6 @@ jobs:
git commit -m "Update branch" || echo "This branch is not behind the upstream" git commit -m "Update branch" || echo "This branch is not behind the upstream"
git push origin main --force git push origin main --force
outputs:
MAIN_YML_FILES_INCONSISTENT: ${{ steps.Compare.outputs.MAIN_YML_FILES_INCONSISTENT }}
CheckScores: CheckScores:
name: CheckScores name: CheckScores
needs: SyncFork needs: SyncFork
@@ -166,7 +169,7 @@ jobs:
echo "Workflow Name: ${{ github.workflow }}" echo "Workflow Name: ${{ github.workflow }}"
echo "Workflow Number: ${{ github.run_number }}" echo "Workflow Number: ${{ github.run_number }}"
echo "Workflow ID: ${{ github.run_id }}" echo "Workflow ID: ${{ github.run_id }}"
echo "Beijing Time: $BEIJING_TIME" | tee time.txt echo "Beijing Time: $BEIJING_TIME" | # tee time.txt 去掉注释后可将时间写入文件
# 删除__pycache__文件夹 # 删除__pycache__文件夹
- name: Delete __pycache__ folder - name: Delete __pycache__ folder
+25
View File
@@ -0,0 +1,25 @@
name: Date Workflow
on:
workflow_dispatch:
jobs:
job1:
name: Get Current Date
runs-on: ubuntu-latest
outputs:
date: ${{ steps.set-date.outputs.date }} # 定义作业1的输出变量
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set Date Variable
id: set-date
run: echo "::set-output name=date::2020"
job2:
name: Output Date from Job 1
runs-on: ubuntu-latest
needs: job1
steps:
- name: Print Date from Job 1
run: echo "The date from Job 1 is ${{ needs.job1.outputs.date }}"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB