Delete .github/workflows/python.yml #30
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: Trigger Workflow and Complete Job | ||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
jobs: | ||
trigger-workflow: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 # Overall timeout for this job | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install dependencies | ||
run: pip install -r requirements.txt | ||
- name: Run workflow trigger script | ||
id: trigger | ||
env: | ||
TOKEN: ${{ secrets.TOKEN }} | ||
REPO_OWNER: ${{ secrets.REPO_OWNER }} | ||
REPO_NAME: ${{ secrets.REPO_NAME }} | ||
WORKFLOW_ID: ${{ secrets.WORKFLOW_ID }} | ||
run: | | ||
python Main.py | ||
if [ $? -eq 0 ]; then | ||
echo "Workflow triggered successfully!" | ||
echo "TRIGGERED=true" >> $GITHUB_ENV | ||
else | ||
echo "Failed to trigger workflow." | ||
exit 1 | ||
fi | ||
complete-job: | ||
runs-on: ubuntu-latest | ||
needs: trigger-workflow | ||
if: env.TRIGGERED == 'true' | ||
Check failure on line 46 in .github/workflows/python-app.yml GitHub Actions / Trigger Workflow and Complete JobInvalid workflow file
|
||
steps: | ||
- name: Complete Job | ||
run: | | ||
echo "Trigger was successful. Completing the job." | ||
exit 0 # Exit with code 0 to mark the job as successful | ||
# Optional: Handle failure if trigger fails | ||
handle-failure: | ||
runs-on: ubuntu-latest | ||
needs: trigger-workflow | ||
if: env.TRIGGERED != 'true' | ||
steps: | ||
- name: Handle Failure | ||
run: | | ||
echo "Trigger failed. Taking necessary actions." | ||
exit 1 # Exit with code 1 to indicate failure |