Skip to content

Fix workflows: remove reference to non-existent set_environment job and add staging support - #76

Draft
ronaldtse with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-build-deploy-workflow
Draft

Fix workflows: remove reference to non-existent set_environment job and add staging support#76
ronaldtse with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-build-deploy-workflow

Conversation

Copilot AI commented Nov 11, 2025

Copy link
Copy Markdown

Both build_deploy.yml and check_links.yml reference needs.set_environment.outputs.data_branch but no set_environment job exists, causing workflow failures. Additionally, build_deploy.yml was missing the staging branch trigger and both workflows had hardcoded environment configurations.

Changes

  • Replace needs.set_environment.outputs.data_branch with conditional expression based on github.ref
  • Expression maps refs/heads/stagingstaging branch, defaults to main for all other refs
  • Applied to both build_deploy.yml and check_links.yml workflows
  • Add staging to trigger branches in build_deploy.yml to match check_links.yml
  • Make environment names and URLs conditional based on branch
# Before (data branch reference)
ref: ${{ needs.set_environment.outputs.data_branch }}

# After  
ref: ${{ github.ref == 'refs/heads/staging' && 'staging' || 'main' }}
# Before (build_deploy.yml triggers)
on:
  push:
    branches:
    - main

# After (build_deploy.yml triggers)
on:
  push:
    branches:
    - main
    - staging
# Before (environment configuration)
environment:
  name: production
  url: https://www.ituob.org

# After (conditional environment)
environment:
  name: ${{ github.ref == 'refs/heads/staging' && 'staging' || 'production' }}
  url: ${{ github.ref == 'refs/heads/staging' && 'https://staging-www.ituob.org' || 'https://www.ituob.org' }}

This aligns with the documented behavior where production deploys from itu-ob-data@main to https://www.ituob.org and staging deploys from itu-ob-data@staging to https://staging-www.ituob.org. Both workflows now trigger on both main and staging branches and use the appropriate GitHub environment configuration for each deployment target.

Original prompt

Fix the code for the build_deploy workflow


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: ronaldtse <11865+ronaldtse@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix code for build_deploy workflow Fix workflows: remove reference to non-existent set_environment job Nov 11, 2025
Copilot AI requested a review from ronaldtse November 11, 2025 03:30
@ronaldtse

Copy link
Copy Markdown
Contributor

@copilot continue fixing

Co-authored-by: ronaldtse <11865+ronaldtse@users.noreply.github.com>

Copilot AI commented Nov 11, 2025

Copy link
Copy Markdown
Author

@copilot continue fixing

Completed the fix. Added staging branch trigger to build_deploy workflow in commit 3f06ece.

The workflow now:

  • Triggers on both main and staging branches
  • Uses correct data branch (itu-ob-data@staging for staging, itu-ob-data@main otherwise)
  • Deploys to GitHub Pages only on main branch

Both workflows are now consistent and match the documented behavior in README.

Copilot AI changed the title Fix workflows: remove reference to non-existent set_environment job Fix workflows: remove reference to non-existent set_environment job and add staging support Nov 11, 2025
@ronaldtse

Copy link
Copy Markdown
Contributor

@copilot fix the remaining issues for deployment

Co-authored-by: ronaldtse <11865+ronaldtse@users.noreply.github.com>

Copilot AI commented Nov 11, 2025

Copy link
Copy Markdown
Author

@copilot fix the remaining issues for deployment

Fixed deployment environment configuration in commit 791bf42.

Both workflows now use conditional environments based on the branch:

  • staging branch → uses 'staging' environment with staging-www.ituob.org URL
  • main branch → uses 'production' environment with www.ituob.org URL

This allows GitHub environment protection rules and configurations to work correctly for each deployment target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants