[Application] Crypto Hustler 101 #89
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Add new applicant | |
on: | |
issues: | |
types: [labeled] | |
permissions: write-all | |
concurrency: update-applicant | |
jobs: | |
check-issue-labeled: | |
runs-on: ubuntu-latest | |
if: contains(github.event.issue.labels.*.name, 'approved') && contains(github.event.issue.labels.*.name, 'application') | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Check Issue Label | |
run: echo "Issue is approved" | |
- name: View the github context | |
run: echo "$GITHUB_CONTEXT" | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
- name: Get Issue Body | |
id: issue-body | |
run: echo "${{ github.event.issue.body }}" | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Prepare | |
run: | | |
git --version | |
git config user.name "GitHub Actions Bot" | |
git config user.email "" | |
git fetch --all | |
git checkout release | |
git pull | |
mkdir -p profiles | |
mkdir -p selected_images | |
- name: Add new applicant and update README.md of images | |
id: add-applicant | |
continue-on-error: true | |
run: | | |
npm install | |
npm run start add-applicant "${{ github.event.issue.body }}" | |
npm run start generate-images-readme | |
- name: Commit | |
if: steps.add-applicant.outcome == 'success' | |
run: | | |
git add . | |
git commit -m "Add a new applicant" | |
git push | |
- name: Check if the applicant is conforming | |
id: check | |
if: steps.add-applicant.outcome == 'failure' | |
uses: peter-evans/create-or-update-comment@v2 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
The application is not conforming to the requirements. Please check: | |
- The Picture field is the name of the file in the folder of images, without the .png suffix. | |
- Please check if this picture is in the folder of images of branch release. | |
- name: Remove approved label if updation fails | |
if: steps.add-applicant.outcome == 'failure' | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.removeLabel({ | |
issue_number: context.payload.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: 'approved' | |
}) | |