File tree Expand file tree Collapse file tree 3 files changed +109
-0
lines changed
Expand file tree Collapse file tree 3 files changed +109
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Adds content to the git stage
2+ description : |
3+ A composite action for adding content to the git stage.
4+
5+ inputs :
6+ path :
7+ required : false
8+ default : " ."
9+ description : " The path or paths to the content to add"
10+ outputs :
11+ staged :
12+ value : ${{ steps.add.outputs.staged }}
13+ description : " `true` if any output was staged; `false` otherwise"
14+
15+ runs :
16+ using : " composite"
17+ steps :
18+ - name : Add
19+ id : add
20+ shell : bash
21+ run : |
22+ git add ${{ inputs.path }}
23+ if ! git diff --cached --exit-code 2>&1 1>/dev/null; then
24+ echo "staged=true" >> "${GITHUB_OUTPUT}"
25+ else
26+ echo "staged=false" >> "${GITHUB_OUTPUT}"
27+ fi
Original file line number Diff line number Diff line change 1+ name : Create a git commit
2+ description : |
3+ A composite action for committing the current staged content.
4+
5+ inputs :
6+ title :
7+ required : true
8+ description : " The title of the commit message"
9+ body :
10+ required : false
11+ default : " "
12+ description : " The body of the commit message"
13+ user-name :
14+ required : false
15+ default : " Octocat"
16+ description : " The default user to commit as"
17+ user-email :
18+ required : false
19+ 20+ description : " The email of the user to commit as"
21+ outputs :
22+ sha1 :
23+ value : ${{ steps.commit.outputs.sha1 }}
24+ description : The SHA1 of the newly created commit
25+ sha1-short :
26+ value : ${{ steps.update.outputs.comment-url }}
27+ description : The short/succinct SHA1 of the newly created commit
28+
29+ runs :
30+ using : " composite"
31+ steps :
32+ - name : Commit
33+ id : commit
34+ shell : bash
35+ env :
36+ # Note: using an env variable here since we can use the Github pre-processor
37+ # expansion, which can allow embedded backticks without triggering shell
38+ # substitution.
39+ COMMIT_MESSAGE : |
40+ ${{ inputs.title }}
41+
42+ ${{ inputs.body }}
43+ run : |
44+ git config --global user.email "${{ inputs.user-email }}"
45+ git config --global user.name "${{ inputs.user-name }}"
46+ git commit -m '${{ env.COMMIT_MESSAGE }}'
47+
48+ echo "sha1=$(git rev-parse HEAD)" >> "${GITHUB_OUTPUT}"
49+ echo "sha1-short=$(git rev-parse --short HEAD)" >> "${GITHUB_OUTPUT}"
Original file line number Diff line number Diff line change 1+ name : Push a git branch
2+ description : |
3+ A composite action for pushing a git branch.
4+
5+ This requires `contents: write` permissions in order to work correctly.
6+
7+ inputs :
8+ branch :
9+ required : true
10+ description : " The name of the branch to push"
11+ target-commitish :
12+ required : false
13+ default : HEAD
14+ description : " The commit to push as the new branch"
15+ force :
16+ required : false
17+ default : " false"
18+ description : " Whether to force-push this branch"
19+
20+ runs :
21+ using : " composite"
22+ steps :
23+ - name : Push
24+ shell : bash
25+ run : |
26+ force=""
27+ if [${{ inputs.force }} = "true"]; then
28+ force="--force"
29+ fi
30+
31+ git push \
32+ origin ${{ inputs.target-commitish }}:${{ inputs.branch }} \
33+ ${force}
You can’t perform that action at this time.
0 commit comments