目标:
在 GitHub Actions 中,从 shell 动态定义我的提交消息:
- name: Commit changes
uses: EndBug/add-and-commit@v7
with:
message: "added on $(date -I)"
Run Code Online (Sandbox Code Playgroud)
但是,似乎我必须定义一个环境变量然后使用它。我正在关注如何在 GitHub Actions 中使用 bash 表达式设置环境变量?和其他类似的帮助文件,但仍然无法告诉如何使用我之前定义的环境变量。这是我尝试过但失败的:
- name: Checkout repo
uses: actions/checkout@v2
- run: |
touch sample.js
echo "today=$(date -I)" >> $GITHUB_ENV
- name: Commit changes
uses: EndBug/add-and-commit@v7
with:
message: "added on ${today}"
Run Code Online (Sandbox Code Playgroud)
如何让它发挥作用?
请帮我在同一张图上绘制两个列表。线条应该是不同的颜色。这是我试过的代码:
import matplotlib.pyplot as plt
train_X = [1,2,3,4,5]
train_Y = [10, 20, 30, 40, 50]
train_Z = [10, 20, 30, 40, 50,25]
alpha = float(input("Input alpha: "))
forecast = [] for x in range(0, len(train_X)+1):
if x==0:
forecast.append(train_Y[0])
else:
forecast.append(alpha*train_Y[x-1] + (1 - alpha) * forecast[x-1])
plt.plot(forecast,train_Z,'g')
plt.show()
Run Code Online (Sandbox Code Playgroud)