Skip to content

Commit 3da6262

Browse files
feat: add exercise-title optional parameter to finish-exercise workflow (#65)
1 parent e5e33ff commit 3da6262

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/finish-exercise.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
description: "The URL of the issue to update and close"
88
required: true
99
type: string
10+
exercise-title:
11+
description: "The title of the exercise"
12+
required: false
13+
type: string
1014
update-readme-with-congratulations:
1115
description: "Whether to update the README with a congratulations message"
1216
required: false
@@ -42,10 +46,18 @@ jobs:
4246
- name: Encode socials text
4347
id: encode-socials-text
4448
uses: actions/github-script@v7
49+
env:
50+
EXERCISE_TITLE: ${{ inputs.exercise-title }}
4551
with:
4652
script: |
4753
const repoUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}`;
48-
const socialsText = `I just completed a GitHub Skills exercise! 🎉
54+
const exerciseTitle = process.env.EXERCISE_TITLE;
55+
56+
const firstLine = exerciseTitle && exerciseTitle.trim() !== ''
57+
? `I just completed the "${exerciseTitle}" GitHub Skills hands-on exercise! 🎉`
58+
: `I just completed a GitHub Skills hands-on exercise! 🎉`;
59+
60+
const socialsText = `${firstLine}
4961
5062
${repoUrl}
5163
@@ -97,7 +109,6 @@ jobs:
97109
template-vars: |
98110
login: ${{ github.actor }}
99111
repo_full_name: ${{ github.repository }}
100-
101112
- name: Create comment - exercise finished
102113
run: |
103114
gh issue comment "${{ inputs.issue-url }}" \

0 commit comments

Comments
 (0)