Skip to content

Commit 5ff63fd

Browse files
author
Maxime Boisvert
committed
update: workflow
1 parent a4765fc commit 5ff63fd

1 file changed

Lines changed: 40 additions & 4 deletions

File tree

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,46 @@
11
name: 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

610
jobs:
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 }}

0 commit comments

Comments
 (0)