Block Hotel #461
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
# When the PR is labeled 'Grant Translated' do the following: | |
# Add it to the Grant Committee Voting Google Sheet | |
# | |
# Ted Cahall May 21, 2022 | |
name: Grant Translated | |
on: | |
pull_request_target: | |
types: labeled | |
jobs: | |
get_filename: | |
runs-on: ubuntu-latest | |
outputs: | |
filename: ${{ steps.files.outputs.added }} | |
steps: | |
- name: Get grant application file name | |
id: 'files' | |
uses: Ana06/[email protected] | |
with: | |
filter: 'applications/*.md' | |
parse_app: | |
needs: get_filename | |
if: needs.get_filename.outputs.filename | |
runs-on: ubuntu-latest | |
outputs: | |
app_email: ${{ steps.grep_email.outputs.email_addr }} | |
contact_name: ${{ steps.grep_email.outputs.contact_name }} | |
project_name: ${{ steps.grep_email.outputs.project_name }} | |
team_name: ${{ steps.grep_email.outputs.team_name }} | |
total_cost: ${{ steps.grep_email.outputs.total_cost }} | |
steps: | |
- name: Checkout | |
id: checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Echo_file | |
run: echo This is the file ${{ needs.get_filename.outputs.filename }} | |
# Parse the application template for the email account | |
- name: assign the env from the email name | |
id: grep_email | |
run: | | |
export APP_EMAIL=`/bin/grep -F "**Contact Email:**" ${{ needs.get_filename.outputs.filename }} | tr -s " " | cut -d" " -f4` | |
echo "email_addr=$APP_EMAIL" >> $GITHUB_OUTPUT | |
# old way-> echo "::set-output name=email_addr::$APP_EMAIL" | |
export CNAME=`/bin/grep -F "**Contact Name:**" ${{ needs.get_filename.outputs.filename }} | tr -s " " | cut -d" " -f4-8` | |
echo "contact_name=$CNAME" >> $GITHUB_OUTPUT | |
export PNAME=`/bin/grep -F "**Project Name:**" ${{ needs.get_filename.outputs.filename }} | tr -s " " | cut -d" " -f4-8` | |
echo "project_name=$PNAME" >> $GITHUB_OUTPUT | |
export TNAME=`/bin/grep -F "**Team Name:**" ${{ needs.get_filename.outputs.filename }} | tr -s " " | cut -d" " -f4-8` | |
echo "team_name=$TNAME" >> $GITHUB_OUTPUT | |
export TCOST=`/bin/grep -F "**Total Costs:**" ${{ needs.get_filename.outputs.filename }} | tr -s " " | cut -d" " -f4-8` | |
echo "total_cost=$TCOST" >> $GITHUB_OUTPUT | |
echo ${{ github.actor }} ${{ github.event_name }} ${{ github.event.pull_request.head.repo.owner.login }} | |
#echo $APP_MAIL $CNAME $PNAME $TNAME $TCOST | |
checklabel: | |
needs: [get_filename, parse_app] | |
if: github.event.label.name == 'Grant Translated' | |
runs-on: ubuntu-latest | |
steps: | |
- id: 'update_worksheet' | |
uses: jroehl/[email protected] | |
with: | |
#spreadsheetId: 1FsNUKcfAJAorZGHpEzbRKLVYWbpZ_93Ts-R-JTpRK_A #This is the DummyTest sheet | |
spreadsheetId: 1RdSK5Y_URnTSzg__fRHV51jwO90x4AUMy0ym0ytWwKA | |
commands: | | |
[ | |
{ "command": "appendData", "args": { "data": [["${{ github.event.pull_request.head.repo.owner.login }}", "${{needs.parse_app.outputs.app_email}}", "${{needs.parse_app.outputs.project_name}}", "${{needs.parse_app.outputs.total_cost}}"]], "worksheetTitle": "Grants", "minCol": 2 }} | |
] | |
env: | |
GSHEET_CLIENT_EMAIL: enf-grant-service-account@sonorous-haven-350712.iam.gserviceaccount.com | |
GSHEET_PRIVATE_KEY: ${{ secrets.GHSEET_API_KEY }} | |
- name: dump results | |
env: | |
RESULTS: ${{ steps.update_worksheet.outputs.results }} | |
run: echo "$RESULTS" | |
alwaysrun: | |
needs: checklabel | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: alwaysrunthis | |
id: in-case-no-labels-matched | |
run: echo "Always step was run to avoid error notice" | |