Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/finish-exercise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
description: "The URL of the issue to update and close"
required: true
type: string
exercise-title:
description: "The title of the exercise"
required: false
type: string
update-readme-with-congratulations:
description: "Whether to update the README with a congratulations message"
required: false
Expand Down Expand Up @@ -42,10 +46,18 @@ jobs:
- name: Encode socials text
id: encode-socials-text
uses: actions/github-script@v7
env:
EXERCISE_TITLE: ${{ inputs.exercise-title }}
with:
script: |
const repoUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}`;
const socialsText = `I just completed a GitHub Skills exercise! 🎉
const exerciseTitle = process.env.EXERCISE_TITLE;

const firstLine = exerciseTitle && exerciseTitle.trim() !== ''
? `I just completed the "${exerciseTitle}" GitHub Skills hands-on exercise! 🎉`
: `I just completed a GitHub Skills hands-on exercise! 🎉`;

const socialsText = `${firstLine}

${repoUrl}

Expand Down Expand Up @@ -97,7 +109,6 @@ jobs:
template-vars: |
login: ${{ github.actor }}
repo_full_name: ${{ github.repository }}

- name: Create comment - exercise finished
run: |
gh issue comment "${{ inputs.issue-url }}" \
Expand Down