Repository navigation
ci: sync the slack-cli skill from slack-skills-plugin each day - #736
Conversation
A scheduled job downloads the skill from the plugin's main branch and opens a pull request when it changed, the same way the golang job bumps the Go version.
| env: | ||
| GITHUB_TOKEN: ${{ steps.credentials.outputs.token }} | ||
| VERSION: ${{ steps.version.outputs.latest }} | ||
| skill: |
There was a problem hiding this comment.
note: This job is a copy of the golang job above. It uses the same daily schedule, token, labels, and milestone, so there's nothing new to maintain.
| token: ${{ steps.credentials.outputs.token }} | ||
| - name: Download the latest skill | ||
| run: | | ||
| curl -fsSL "https://raw.githubusercontent.com/slackapi/slack-skills-plugin/main/skills/slack-cli/SKILL.md" -o cmd/skill/SKILL.md |
There was a problem hiding this comment.
note: We download from the plugin's main branch because that's what npx skills installs. The -f flag fails the step on a 404 instead of writing an error page into SKILL.md.
There was a problem hiding this comment.
ποΈβπ¨οΈ thought: Using curl is clever... I would've checked out the entire skills repo but let's not add complications if not needed of course!
There was a problem hiding this comment.
Thanks! The skill is a single file, so curl keeps it simple. If we ever bundle more of the plugin, checking out the repo would be the way to go.
| exit 0 | ||
| fi | ||
| git commit --all -m "chore: sync the slack-cli skill from slack-skills-plugin" | ||
| git push -u origin chore-sync-skill |
There was a problem hiding this comment.
note: Like the golang job, this push fails if an earlier sync PR is still open. A failed run means a sync PR is waiting to merge.
There was a problem hiding this comment.
πͺ¬ question: Do you think updating an existing PR or branch would be better? I don't think we'd want to merge an outdated skill change PR?
There was a problem hiding this comment.
Agreed, an outdated sync PR shouldn't merge. In e00279a the job force-pushes the bot's chore-sync-skill branch from the latest main with the latest skill, and skips gh pr create when a sync PR is already open. So an open PR always has the newest skill.
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #736 +/- ##
=======================================
Coverage 78.17% 78.17%
=======================================
Files 240 240
Lines 18164 18164
=======================================
Hits 14199 14199
Misses 3965 3965 β View full report in Codecov by Harness. π New features to boost your workflow:
|
| with: | ||
| client-id: ${{ secrets.GH_APP_CLIENT_ID_RELEASER }} | ||
| private-key: ${{ secrets.GH_APP_PRIVATE_KEY_RELEASER }} |
There was a problem hiding this comment.
π suggestion: Perhaps we can scope the app token to what this job needs? zizmor flags github-app here since the token inherits all of the installation permissions. The golang job could follow in a separate change I think.
| with: | |
| client-id: ${{ secrets.GH_APP_CLIENT_ID_RELEASER }} | |
| private-key: ${{ secrets.GH_APP_PRIVATE_KEY_RELEASER }} | |
| with: | |
| client-id: ${{ secrets.GH_APP_CLIENT_ID_RELEASER }} | |
| private-key: ${{ secrets.GH_APP_PRIVATE_KEY_RELEASER }} | |
| permission-contents: write | |
| permission-pull-requests: write |
| token: ${{ steps.credentials.outputs.token }} | ||
| - name: Download the latest skill | ||
| run: | | ||
| curl -fsSL "https://raw.githubusercontent.com/slackapi/slack-skills-plugin/main/skills/slack-cli/SKILL.md" -o cmd/skill/SKILL.md |
There was a problem hiding this comment.
ποΈβπ¨οΈ thought: Using curl is clever... I would've checked out the entire skills repo but let's not add complications if not needed of course!
| exit 0 | ||
| fi | ||
| git commit --all -m "chore: sync the slack-cli skill from slack-skills-plugin" | ||
| git push -u origin chore-sync-skill |
There was a problem hiding this comment.
πͺ¬ question: Do you think updating an existing PR or branch would be better? I don't think we'd want to merge an outdated skill change PR?
The app token gets only the contents and pull requests permissions it needs. When a sync pull request is already open, the job replaces its branch with the latest skill on main instead of failing the push.
Summary
This pull request keeps the skill printed by
slack skillcurrent for maintainers, without anyone copying it by hand. A daily job downloads theslack-cliskill from themainbranch of slackapi/slack-skills-plugin and opens a pull request when it changed.It's a copy of the
golangjob in the same workflow, with the same schedule, token, labels, and milestone.mainis also the branchnpx skillsinstalls the skill from.Testing
curland diff it againstcmd/skill/SKILL.md. Pluginmainnow uses bare skill names (create-slack-app, notslack:create-slack-app) since fix: reference skills by the name every install path registersΒ slack-skills-plugin#191, so the first run opens a sync pull request.curlat a missing path and confirm it fails the step instead of writing an error page into the skill file.workflow_dispatchand confirm the "Sync the agent skill" job passes.Notes
golangjob, a second change before the first sync PR merges makes the push fail until it does.Requirements