Skip to content

Commit

Permalink
Add error message
Browse files Browse the repository at this point in the history
  • Loading branch information
eerison committed Mar 27, 2023
1 parent 5c83fea commit 642db3a
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 14 deletions.
1 change: 0 additions & 1 deletion .github/workflows/discussion-comment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
with:
organization: 'shield-wall'
repository: 'myprofile'
# discussionId: ${{inputs.php_versions}}
discussionId: ${{inputs.discussionId}}
body: ${{inputs.body}}

55 changes: 44 additions & 11 deletions .github/workflows/resume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

jobs:
discussion-comment-initial:
name: Initial comment
uses: shield-wall/myprofile/.github/workflows/discussion-comment.yaml@master
if: github.event_name == 'discussion'
with:
Expand All @@ -22,6 +23,8 @@ jobs:
runs-on: ubuntu-latest
name: Generate pdf
if: github.event_name == 'discussion' || github.event.label.name == 'template'
outputs:
yaml-lint: ${{ steps.yaml-lint-output.outputs.message }}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
Expand All @@ -42,14 +45,23 @@ jobs:
with:
path: ./data/data.txt
contents: ${{github.event.discussion.body}}
- run: |
npm run node:generate:data
npm run lint:check:yaml
if: github.event_name == 'discussion'

- if: github.event_name == 'discussion'
run: npm run node:generate:data

# Process from pull request.
- run: npm run node:copy-data
if: github.event_name == 'pull_request'
- if: github.event_name == 'pull_request'
run: npm run node:copy-data

- name: Yaml lint
continue-on-error: true
run: npm run lint:check:yaml > data/log/lint-yaml.txt

- name: Pass output lint to github output.
id: yaml-lint-output
run: |
cat data/log/lint-yaml.txt
echo "message=cat data/log/lint-yaml.txt" >> "$GITHUB_OUTPUT"
- run: npm run node:generate:json
- run: npm run build
Expand All @@ -68,12 +80,33 @@ jobs:
CLOUDFLARE_ACCOUNT_ID: ${{secrets.CLOUDFLARE_ACCOUNT_ID}}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

discussion-comment-final:
discussion-comment-success:
name: Success comment
uses: shield-wall/myprofile/.github/workflows/discussion-comment.yaml@master
if: github.event_name == 'discussion'
# if: github.event_name == 'discussion' && needs.resume.result == 'success'
if: needs.resume.result == 'success'
needs: resume
with:
discussionId: ${{github.event.discussion.number}}
# discussionId: ${{github.event.discussion.number}}
discussionId: 723
body: |
Your resume was processed with success :tada: :tada:
Resume link: https://bucket.myprofile.pro/users/${{github.actor}}/resume.pdf
:white_check_mark: Your resume was generated with success :tada: :tada:, you can access using the link bellow.
**:page_with_curl: https://bucket.myprofile.pro/users/${{github.actor}}/resume.pdf**
discussion-comment-failure:
name: Failure comment
uses: shield-wall/myprofile/.github/workflows/discussion-comment.yaml@master
# if: github.event_name == 'discussion'
if: ${{ always() }} && needs.resume.result == 'failure'
needs: resume
with:
# discussionId: ${{github.event.discussion.number}}
discussionId: 723
body: |
:x: :bangbang: We couldn't generate your resume :disappointed_relieved: , we found out this issue related with your **yaml syntax**.
Please fix the **issue** bellow and after that **edit your discussion's description** to try again :arrows_clockwise: :wink:
:point_down: :point_down:
```bash
${{needs.resume.outputs.yaml-lint}}
```
2 changes: 1 addition & 1 deletion data/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
json
pdf
data.yaml
data.txt
data.txt
2 changes: 1 addition & 1 deletion data/data.yaml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ sectionTwo:
#[education section]
- title: Education
icon: education
children:
children:
- degree: Master of Arts
institution: Harvard
timePeriod: March 2012 - December 2013
Expand Down
1 change: 1 addition & 0 deletions data/log/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.txt

0 comments on commit 642db3a

Please sign in to comment.