Skip to content

Commit 732ba9b

Browse files
feat: add share to X button in final README (#57)
1 parent 9279add commit 732ba9b

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

.github/workflows/finish-exercise.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ permissions:
1818
issues: write
1919

2020
env:
21-
EXERCISE_TOOLKIT_REF: dd3788a80f626a1f79fa1b1c3b47b7686f7e1bc2
21+
EXERCISE_TOOLKIT_REF: a3125d8f055a01f6827a5caf9ca592711e706750
2222

2323
jobs:
2424
update_readme:
@@ -39,6 +39,22 @@ jobs:
3939
path: exercise-toolkit
4040
ref: ${{ env.EXERCISE_TOOLKIT_REF }}
4141

42+
- name: Encode socials text
43+
id: encode-socials-text
44+
uses: actions/github-script@v7
45+
with:
46+
script: |
47+
const repoUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}`;
48+
const socialsText = `I just completed a GitHub Skills exercise! 🎉
49+
50+
${repoUrl}
51+
52+
#GitHubSkills #OpenSource #GitHubLearn
53+
`;
54+
55+
const encodedText = encodeURIComponent(socialsText);
56+
core.setOutput('encoded-text', encodedText);
57+
4258
- name: Build congratulations message from template
4359
id: build-new-readme
4460
uses: skills/action-text-variables@v2
@@ -47,6 +63,7 @@ jobs:
4763
template-vars: |
4864
login: ${{ github.actor }}
4965
issue_url: ${{ inputs.issue-url }}
66+
encoded_socials_text: ${{ steps.encode-socials-text.outputs.encoded-text }}
5067
5168
- name: Overwrite README
5269
env:

markdown-templates/readme/exercise-finished.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ If you would like to retrace your steps, you can always revisit the exercise.
1111
> [!TIP]
1212
> Mona won't grade you this time! 😉
1313
14+
### 🚀 Share Your Success!
15+
16+
Show off your new skills and inspire others in the developer community!
17+
18+
<a href="https://twitter.com/intent/tweet?text={{ encoded_socials_text }}" target="_blank" rel="noopener noreferrer">
19+
<img src="https://img.shields.io/badge/Share%20on%20X-1da1f2?style=for-the-badge&logo=x&logoColor=white" alt="Share on X" />
20+
</a>
21+
22+
---
1423

1524
### Craving more? :raising_hand:
1625

0 commit comments

Comments
 (0)