I have the same code in function_app.py file alike you.
I am trying to deploy the codes to function app using GitHub action with the help of below given script.
```yaml
name: Build and deploy Python project to Azure Function App - afreeen-fa
on:
push:
branches:
- main
workflow_dispatch:
env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.'
PYTHON_VERSION: '3.11'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python version
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Create and start virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: pip install -r requirements.txt
- name: Zip artifact for deployment
run: zip release.zip ./* -r
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: python-app
path: |
release.zip
!venv/
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: python-app
- name: Unzip artifact for deployment
run: unzip release.zip
- name: 'Deploy to Azure Functions'
uses: Azure/functions-action@v1
id: deploy-to-function
with:
app-name: 'afreeen-fa'
slot-name: 'Production'
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_BEA2A185EB094***8218 }}
```
Post successful deployment, I can see the functions in function app's Overview blade as shown below.

I tried deploying Python Function via Github Actions and it was successful, Refer below:-
My Python Function V2 [Github Repository](https://github.com/sid24desai/PyFuncv2) For Python Function V1 refer my [SO answer](https://stackoverflow.com/questions/76276661/unable-to-explain-why-my-python-based-azure-function-is-not-appearing-when-using/76277867#76277867)
My **github yaml pipeline:**-
```yaml
name: Build and deploy Python project to Azure Function App - siliconfuncapp
on:
push:
branches:
- main
workflow_dispatch:
env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.'
PYTHON_VERSION: '3.11'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python version
uses: actions/setup-python@v1
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Create and start virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: pip install -r requirements.txt
- name: Zip artifact for deployment
run: zip release.zip ./* -r
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: python-app
path: |
release.zip
!venv/
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-function.outputs.webapp-url }}
permissions:
id-token: write
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: python-app
- name: Unzip artifact for deployment
run: unzip release.zip
- name: Login to Azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_D0F74B57F2B045B5BC8B8494FB4C84C6 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_2F1CE8D0C7B34809983E6F310DC66814 }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_35BE8BB9D9374F79ABFD06397E18EB36 }}
- name: 'Deploy to Azure Functions'
uses: Azure/functions-action@v1
id: deploy-to-function
with:
app-name: 'siliconfuncapp'
slot-name: 'Production'
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
scm-do-build-during-deployment: true
enable-oryx-build: true
```
**Output:-**


My ***Function App settings***:-
```txt
AzureWebJobsStorage:DefaultEndpointsProtocol=https;AccountName=siliconrg988a9c;AccountKey=xxxxxxx=;EndpointSuffix=core.windows.net
ENABLE_ORYX_BUILD:1
FUNCTIONS_EXTENSION_VERSION:~4
FUNCTIONS_WORKER_RUNTIME:python
SCM_DO_BUILD_DURING_DEPLOYMENT:1
```

Refer the Answers in this [SO thread](https://stackoverflow.com/questions/68327652/error-with-github-action-deploy-to-azure-web-app) to get insights into your error.