Skip to content

Commit

Permalink
Adding base pipeline config and my own entry to the heroes list.
Browse files Browse the repository at this point in the history
  • Loading branch information
jordangov authored Jul 2, 2024
1 parent 55de7c0 commit e2bf048
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 9 deletions.
47 changes: 41 additions & 6 deletions .github/workflows/hero-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,52 @@ on:
branches: [ "main" ]

jobs:
test:
check-for-hero:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Checkout Code
uses: actions/checkout@v4
with:
repository: jordangov/defcon-poc
# token needss to be able read repo contents, write to PRs, and read secrets
token: ${{secrets.GH_TOKEN}}
- name: Run script
run: |
echo "user: ${{github.actor}}"
echo -n "${{github.actor}}-${{secrets.SALT}}" | openssl dgst -${{secrets.ALGO}}
fetch-depth: 0
- name: Check Submission
id: check_sub
run: >-
git fetch origin main;
SUBMISSION=`git diff origin/main..HEAD open-source-heroes.md | awk '/\* @${{github.actor}}/{ print $3 }'`;
echo -n "${{github.actor}}-${{secrets.SALT}}" | openssl dgst -${{secrets.ALGO}};
CHECKSUM=`echo -n "${{github.actor}}-${{secrets.SALT}}" | openssl dgst -${{secrets.ALGO}} | awk '/[a-z0-9]+/{ print $2 }'`;
echo "Confirming submission ($SUBMISSION) equals checksum...";
if [[ "$SUBMISSION" = "$CHECKSUM" ]]; then
echo "Submissions match, they're an open source hero!"
echo "RESULT=pass" >> "$GITHUB_OUTPUT";
echo "MESSAGE='🤩 Wow, you are an open source hero! Find a volunteer with the special White House badge to claim your fame!'" >> "$GITHUB_OUTPUT";
else
echo "Submissions do not match, need to try again."
echo "RESULT=fail" >> "$GITHUB_OUTPUT";
echo "MESSAGE='😔 Sorry, but that is not the right hash. Have you found all of the clues?'" >> "$GITHUB_OUTPUT";
fi
- name: Post Message
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: ${{ steps.check_sub.outputs.MESSAGE }}
})
- name: End Job
env:
RESULT: ${{ steps.check_sub.outputs.RESULT }}
run: >-
echo "RESULT=$RESULT";
if [[ "$RESULT" = "pass" ]]; then
exit 0;
else
exit 1;
fi
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# DEF CON 32 Open Source Heros
# DEF CON 32 Open Source Heroes

> This repo is a **proof of concept** for the Open Source Hero Badge at DEF CON 32.
>
> Check out the [open-source-heroes.md](open-source-heroes.md) file for instructions.
5 changes: 3 additions & 2 deletions open-source-heros.md → open-source-heroes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Open Source Heros
# Open Source Heroes

This is the list of heros. Add your name to the list below with your GitHub handle and the correct hash.
This is the list of heroes. Add your name to the list below with your GitHub handle and the correct hash.

> **INSTRUCTIONS**: You must open a Pull Request to this repository, correctly adding your name to the list below along with the correct hash per the hints you have found elsewhere during DEF CON 32.
>
Expand All @@ -12,3 +12,4 @@ This is the list of heros. Add your name to the list below with your GitHub hand
## The List

* @whitehouse 7e2aac5579f5e3fb61c2ba63f95cfb7a87cb3da8
* @jordangov 6119660cad1e64ddc93cde48e2d617e3cc00071e

0 comments on commit e2bf048

Please sign in to comment.