diff --git a/.github/workflows/CD-azure-functions.yml b/.github/workflows/CD-azure-functions.yml index 84a4310..eb2b551 100644 --- a/.github/workflows/CD-azure-functions.yml +++ b/.github/workflows/CD-azure-functions.yml @@ -1,15 +1,15 @@ -name: CD process to deploy to AzureFuncions +name: CD Azure Functions deployment on: - # Trigger the workflow on pull request but only for the master branch - pull_request: - types: [closed] + # Trigger the workflow on push or pull request, + # but only for the main branch + push: branches: - - master + - pipe env: - AZURE_FUNCTIONAPP_NAME: AutomaticClockOuts # set this to your application's name - AZURE_FUNCTIONAPP_PACKAGE_PATH: './AutomaticClockOuts' # set this to the path to your web app project, defaults to the repository root + AZURE_FUNCTIONAPP_NAME: 'time-tracker-azure-functions' + AZURE_FUNCTIONAPP_PACKAGE_PATH: 'AutomaticClockOuts' # set this to the path to your web app project, defaults to the repository root jobs: build-and-deploy: @@ -21,14 +21,17 @@ jobs: node-version: '10.x' - name: 'run npm' run: | - pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}' + curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + cd AutomaticClockOuts + npm i -g azure-functions-core-tools@core --unsafe-perm true + az login -u ${{ secrets.AZ_USERNAME }} -p ${{ secrets.AZ_PASSWORD }} npm install - npm run build --if-present - popd - - name: 'Run Azure Functions Action' - uses: Azure/functions-action@v1 - id: fa - with: - app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }} - package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} - publish-profile: ${{ secrets.SCM_CREDENTIALS }} + func settings add FUNCTIONS_WORKER_RUNTIME node + func azure functionapp publish time-tracker-azure-functions --node +# - name: 'Run Azure Functions Action' +# uses: Azure/functions-action@v1 +# id: fa +# with: +# app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }} +# package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} +# publish-profile: ${{ secrets.SCM_CREDENTIALS }} diff --git a/AutomaticClockOuts/clock_out.js b/AutomaticClockOuts/clock_out.js index 8c18e70..b72967c 100644 --- a/AutomaticClockOuts/clock_out.js +++ b/AutomaticClockOuts/clock_out.js @@ -32,7 +32,7 @@ const doClockOut = async (context) => { if(totalClockOutsExecuted > 0){ axios.post(slackWebHook, { - "text": `Hey guys, I did a clock out for you. \nVisit https://timetracker.ioet.com/ and set the right end time for your entries :pls: \n- ${usersWithClockOut.join('\n- ')}` + "text": `Hey guys, I just did a clock out for you. \nPlease visit https://timetracker.ioet.com/ and set the right end time for your entries :pls: \n- ${usersWithClockOut.join('\n- ')}` } ) .then(function (response) {