Add workflow to sync actions/ from github/gh-aw into this repo#1
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
actions/ from github/gh-aw into this repo
There was a problem hiding this comment.
Pull request overview
Adds a GitHub Actions workflow to keep this repository’s actions/ directory in sync with github/gh-aw/actions via manual (workflow_dispatch) or programmatic (repository_dispatch) triggers, including logging, permission/fork guards, and optional tagging.
Changes:
- Introduces
.github/workflows/sync-actions.ymlto resolve a source ref (includinglatest) and sparse-check outgithub/gh-aw/actions. - Syncs the
actions/directory into this repo usingrsync --archive --delete, then commits/pushes tomainonly when changes exist. - Optionally creates/updates a tag matching the provided ref when it isn’t
latestor a full 40-char SHA.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| echo "resolved_ref=$RESOLVED_REF" >> "$GITHUB_OUTPUT" | ||
| echo "raw_ref=$RAW_REF" >> "$GITHUB_OUTPUT" | ||
| echo "should_create_tag=$SHOULD_CREATE_TAG" >> "$GITHUB_OUTPUT" |
There was a problem hiding this comment.
RAW_REF comes from workflow_dispatch / repository_dispatch input and is written to $GITHUB_OUTPUT using plain echo "key=$value". If RAW_REF contains newlines, it can break the output file format and inject/override step outputs. Use the multiline $GITHUB_OUTPUT format (or otherwise sanitize/validate the ref) before writing outputs.
| echo "resolved_ref=$RESOLVED_REF" >> "$GITHUB_OUTPUT" | |
| echo "raw_ref=$RAW_REF" >> "$GITHUB_OUTPUT" | |
| echo "should_create_tag=$SHOULD_CREATE_TAG" >> "$GITHUB_OUTPUT" | |
| DELIM="EOF_$(date +%s)_$RANDOM" | |
| { | |
| echo "resolved_ref<<$DELIM" | |
| echo "$RESOLVED_REF" | |
| echo "$DELIM" | |
| echo "raw_ref<<$DELIM" | |
| echo "$RAW_REF" | |
| echo "$DELIM" | |
| echo "should_create_tag=$SHOULD_CREATE_TAG" | |
| } >> "$GITHUB_OUTPUT" |
| fi | ||
|
|
||
| git tag -a "$TAG" -m "Sync from gh-aw@$TAG" | ||
| git push origin "$TAG" |
There was a problem hiding this comment.
The tag name is derived from user-controlled raw_ref. Git commands here should defensively disambiguate options/refspecs and push an explicit tag ref. As written, git push origin "$TAG" can be ambiguous (e.g., TAG=main may push the branch) and a tag starting with - could be parsed as an option unless -- is used.
| git push origin "$TAG" | |
| git push origin -- "refs/tags/$TAG" |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
This repo maintains a lightweight copy of the actions developed in
github/gh-aw. This adds the automation to keep it in sync.Workflow:
.github/workflows/sync-actions.ymlTriggers
repository_dispatch(type:sync-actions) — for programmatic invocation from gh-aw CIworkflow_dispatchwith optionalrefinput (default:latest)Runtime guards
adminormaintainrole (checked via GitHub API)Ref resolution
latest→ resolves to the most recentgithub/gh-awrelease tag; falls back tomainHEAD SHA if no releases existSync strategy
actions/fromgithub/gh-awat the resolved refrsync --archive --delete— remote wins: files absent from the source are deleted locallymainonly when there are actual changesTagging
refis neither a full 40-char SHA norlatest, creates (or force-updates) a tag= refon the new commit — keeps version tags in this repo aligned with gh-aw releasesLogging
::group::blocks; before/after directory listings and full rsync output are captured for easy debuggingOriginal prompt
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.