Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 2, 2025

Updates the buildtools trigger workflow to automatically fire when version tags are pushed instead of requiring manual dispatch.

Changes

  • Trigger: Added push.tags with pattern v*.*.* to match semantic version tags (e.g., v5.6.7)
  • Event type: Changed from "remote build" to "new-version-tag"
  • Payload: Now includes tag and sha for downstream workflows:
    {"event_type": "new-version-tag", "client_payload": {"tag": "${{ github.ref_name }}", "sha": "${{ github.sha }}"}}
  • Job/step names: Renamed for clarity (triggertrigger-buildtools)
  • Comments: Updated repository references (G2-bld → GSAS-II-buildtools)

Retains workflow_dispatch for manual testing.

Original prompt

Update TriggerRemote.yml to trigger on version tags

Update the .github/workflows/TriggerRemote.yml workflow file to automatically trigger the buildtools workflow when a new version tag is created in the GSAS-II repository.

Changes needed:

  1. Update the workflow name to: Trigger buildtools on new version tag

  2. Update the trigger from only workflow_dispatch to:

    on:
      push:
        tags:
          - 'v*.*.*'  # Matches version tags like v5.6.7
      workflow_dispatch:  # Allows manual triggering for testing
  3. Update the event type in the curl command from "remote build" to "new-version-tag"

  4. Update the client payload to include the tag name and commit SHA:

    {"event_type": "new-version-tag", "client_payload": {"tag": "${{ github.ref_name }}", "sha": "${{ github.sha }}"}}
  5. Update the job name from trigger to trigger-buildtools

  6. Update comments to reflect the new purpose (triggering on version tags instead of manual workflow dispatch)

Complete updated file content:

# Triggers buildtools workflow when a new version tag is created in GSAS-II

# 1) This will trigger GitHub Actions in GSAS-II-buildtools workflows that have
#           on: repository_dispatch:
# 2) an authorized user (Brian, or perhaps organization) creates a
#    personal access token.
#  Do this by clicking on "picture (upper rt) 
#     then "Settings" in drop-down and 
#     then select "Developer settings" (at bottom). 
#     Finally select "Fine-grained tokens"
#  Personal access token settings:
#     select owner: APS;
#     select APS/GSAS-II-buildtools;
#     Repo permissions: contents r/w & metadata: r/o.
# 3) Save the created token in this (GSAS-II) project. 
#     Use repo-level settings on 2nd line from top (may be in ... menu). 
#     Select Actions in Secrets & variables and create a repository secret. 
#     Name assigned must match ${{ secrets.XXX }} in workflow's curl 
#     call ("Authorization:" setting)

name: Trigger buildtools on new version tag

on:
  push:
    tags:
      - 'v*.*.*'  # Matches version tags like v5.6.7
  workflow_dispatch:  # Allows manual triggering for testing

jobs:
  trigger-buildtools:
    runs-on: ubuntu-latest

    steps:
      - name: Trigger buildtools workflow
        run: |
          # config var follows
          repo_owner="AdvancedPhotonSource" 
  
          curl -L \
            -X POST \
            -H "Accept: application/vnd.github+json" \
            -H "Authorization: Bearer ${{ secrets.PAT }}" \
            -H "X-GitHub-Api-Version: 2022-11-28" \
            https://api.github.com/repos/$repo_owner/GSAS-II-buildtools/dispatches \
            -d "{\"event_type\": \"new-version-tag\", \"client_payload\": {\"tag\": \"${{ github.ref_name }}\", \"sha\": \"${{ github.sha }}\"}}"

The tag pattern v*.*.* will match version tags with periods like v5.6.7, v1.2.3, etc., but will not match tags without periods like v1 or v1.2.

This pull request was created as a result of the following prompt from Copilot chat.

Update TriggerRemote.yml to trigger on version tags

Update the .github/workflows/TriggerRemote.yml workflow file to automatically trigger the buildtools workflow when a new version tag is created in the GSAS-II repository.

Changes needed:

  1. Update the workflow name to: Trigger buildtools on new version tag

  2. Update the trigger from only workflow_dispatch to:

    on:
      push:
        tags:
          - 'v*.*.*'  # Matches version tags like v5.6.7
      workflow_dispatch:  # Allows manual triggering for testing
  3. Update the event type in the curl command from "remote build" to "new-version-tag"

  4. Update the client payload to include the tag name and commit SHA:

    {"event_type": "new-version-tag", "client_payload": {"tag": "${{ github.ref_name }}", "sha": "${{ github.sha }}"}}
  5. Update the job name from trigger to trigger-buildtools

  6. Update comments to reflect the new purpose (triggering on version tags instead of manual workflow dispatch)

Complete updated file content:

# Triggers buildtools workflow when a new version tag is created in GSAS-II

# 1) This will trigger GitHub Actions in GSAS-II-buildtools workflows that have
#           on: repository_dispatch:
# 2) an authorized user (Brian, or perhaps organization) creates a
#    personal access token.
#  Do this by clicking on "picture (upper rt) 
#     then "Settings" in drop-down and 
#     then select "Developer settings" (at bottom). 
#     Finally select "Fine-grained tokens"
#  Personal access token settings:
#     select owner: APS;
#     select APS/GSAS-II-buildtools;
#     Repo permissions: contents r/w & metadata: r/o.
# 3) Save the created token in this (GSAS-II) project. 
#     Use repo-level settings on 2nd line from top (may be in ... menu). 
#     Select Actions in Secrets & variables and create a repository secret. 
#     Name assigned must match ${{ secrets.XXX }} in workflow's curl 
#     call ("Authorization:" setting)

name: Trigger buildtools on new version tag

on:
  push:
    tags:
      - 'v*.*.*'  # Matches version tags like v5.6.7
  workflow_dispatch:  # Allows manual triggering for testing

jobs:
  trigger-buildtools:
    runs-on: ubuntu-latest

    steps:
      - name: Trigger buildtools workflow
        run: |
          # config var follows
          repo_owner="AdvancedPhotonSource" 
  
          curl -L \
            -X POST \
            -H "Accept: application/vnd.github+json" \
            -H "Authorization: Bearer ${{ secrets.PAT }}" \
            -H "X-GitHub-Api-Version: 2022-11-28" \
            https://api.github.com/repos/$repo_owner/GSAS-II-buildtools/dispatches \
            -d "{\"event_type\": \"new-version-tag\", \"client_payload\": {\"tag\": \"${{ github.ref_name }}\", \"sha\": \"${{ github.sha }}\"}}"

The tag pattern v*.*.* will match version tags with periods like v5.6.7, v1.2.3, etc., but will not match tags without periods like v1 or v1.2.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: briantoby <9433704+briantoby@users.noreply.github.com>
Copy link
Collaborator

@briantoby briantoby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

Copilot AI changed the title [WIP] Update TriggerRemote.yml to trigger on version tags Update TriggerRemote.yml to trigger on version tags Dec 2, 2025
Copilot AI requested a review from briantoby December 2, 2025 02:55
@briantoby briantoby marked this pull request as ready for review December 2, 2025 02:55
@briantoby briantoby merged commit 8224873 into main Dec 2, 2025
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