File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : Import API spec
22
3- on :
4- workflow_dispatch : {}
3+ n :
4+ workflow_dispatch :
5+ inputs :
6+ target_branch :
7+ description : ' Branch to update'
8+ required : true
59
610jobs :
7- say-hello :
11+ create-files :
812 runs-on : ubuntu-latest
13+ outputs :
14+ filename : ${{ steps.makefile.outputs.filename }}
915 steps :
10- - run : echo "Hello from ${{ github.event.inputs.environment }}"
16+ - id : makefile
17+ run : |
18+ echo "my-data" > output.txt
19+ echo "filename=output.txt" >> $GITHUB_OUTPUT
20+
21+ - uses : actions/upload-artifact@v4
22+ with :
23+ name : output-file
24+ path : output.txt
25+
26+ update-branch :
27+ needs : create-files
28+ runs-on : ubuntu-latest
29+ steps :
30+ - name : Checkout target branch
31+ uses : actions/checkout@v4
32+ with :
33+ ref : ${{ github.event.inputs.target_branch }}
34+
35+ - name : Download artifact
36+ uses : actions/download-artifact@v4
37+ with :
38+ name : output-file
39+
40+ - name : Commit changes
41+ run : |
42+ git config user.name "github-actions"
43+ git config user.email "github-actions@github.com"
44+ git add output.txt
45+ git commit -m "Update branch with generated file" || echo "No changes"
46+ git push origin HEAD:${{ github.event.inputs.target_branch }}
You can’t perform that action at this time.
0 commit comments