File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Bot change from input
2+ on :
3+ workflow_dispatch :
4+ inputs :
5+ change :
6+ description : ' Short instruction for the bot'
7+ required : true
8+
9+ permissions :
10+ contents : write
11+
12+ jobs :
13+ run-bot :
14+ runs-on : ubuntu-latest
15+ steps :
16+ - uses : actions/checkout@v4
17+ with :
18+ fetch-depth : 0
19+
20+ - name : Set up Python
21+ uses : actions/setup-python@v4
22+ with :
23+ python-version : ' 3.11'
24+
25+ - name : Run bot script
26+ env :
27+ CHANGE_INSTRUCTION : ${{ github.event.inputs.change }}
28+ run : |
29+ mkdir -p scripts
30+ echo 'import os, pathlib' > scripts/auto_edit.py
31+ echo 'instr = os.environ.get("CHANGE_INSTRUCTION","(no instruction)")' >> scripts/auto_edit.py
32+ echo 'p = pathlib.Path("BOT_CHANGES.md")' >> scripts/auto_edit.py
33+ echo 'p.write_text(p.read_text() + f"- {instr}\n" if p.exists() else f"- {instr}\n")' >> scripts/auto_edit.py
34+ python3 scripts/auto_edit.py
35+ git config user.name "github-actions"
36+ git config user.email "[email protected] " 37+ git add BOT_CHANGES.md
38+ git commit -m "bot: apply change ${{ github.event.inputs.change }}" || echo "No changes to commit"
39+ git push
You can’t perform that action at this time.
0 commit comments