Patch Missing Releases #3
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
--- | |
# GitHub releases made by @LizardByte-bot were hidden from the GitHub UI and API endpoint `/releases` | |
# on 1/23/2024. The releases can still be accessed at their own URL, and API endpoint. | |
# It was discovered that the releases will re-appear if they are manually "edited". | |
name: Patch Missing Releases | |
on: | |
workflow_dispatch: | |
jobs: | |
patch_missing_releases: | |
name: Patch Missing Releases | |
runs-on: ubuntu-latest | |
steps: | |
- name: Patch | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GH_BOT_TOKEN }} | |
script: | | |
// get all repos in the org | |
console.log(`Getting repos for org: ${context.repo.owner}`) | |
const repos_opts = github.rest.repos.listForOrg.endpoint.merge({ | |
org: context.repo.owner, | |
}) | |
const repos = await github.paginate(repos_opts) | |
console.log(`Found ${repos.length} repos`) | |
// iterate over repos | |
for (const repo of repos) { | |
console.log('--------------------------') | |
console.log(`Updating releases for repo: ${repo.name}`) | |
// tags still exist and they match releases | |
// get all tags for the repo | |
console.log(`Getting tags for repo: ${repo.name}`) | |
const tags_opts = github.rest.repos.listTags.endpoint.merge({ | |
owner: context.repo.owner, | |
repo: repo.name | |
}) | |
const tags = await github.paginate(tags_opts) | |
console.log(`Found ${tags.length} tags`) | |
// iterate over tags | |
for (const tag of tags) { | |
console.log(`Updating release for tag: ${tag.name}`) | |
// get release for tag | |
console.log(`Getting release for tag: ${tag.name}`) | |
const release = await github.rest.repos.getReleaseByTag({ | |
owner: context.repo.owner, | |
repo: repo.name, | |
tag: tag.name | |
}) | |
// edit the release (without making any changes) | |
console.log(`Editing release for tag: ${tag.name}`) | |
await github.rest.repos.updateRelease({ | |
owner: context.repo.owner, | |
repo: repo.name, | |
release_id: release.data.id, | |
}) | |
} | |
} |