Skip to content

Commit

Permalink
Tag all commits to the default branch with 'unstable' and add an auto…
Browse files Browse the repository at this point in the history
… generated 'nightly' tag (#1220)

* Tag all commits to the default branch with 'nightly'

* Swap nightly around, add unstable tag

* Run at 23:55 and use createRef
  • Loading branch information
kyle-sammons authored Jan 28, 2025
1 parent 35bdc0a commit 30c517c
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will create a 'nightly' tag once a day at midnight
# For more information see: https://docs.github.com/en/rest/git/refs?apiVersion=2022-11-28#update-a-reference

name: Tag Default Branch Commits with Nightly

on:
schedule:
- cron: "55 23 * * *"

jobs:
build:
runs-on: ubuntu-22.04
timeout-minutes: 1

steps:
- uses: actions/checkout@v4
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Update nigtly tag
uses: actions/github-script@v5
env:
TAG_DATE: ${{ steps.date.outputs.date }}
with:
script: |
const { TAG_DATE } = process.env
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/nightly-${TAG_DATE}`,
sha: context.sha
})
28 changes: 28 additions & 0 deletions .github/workflows/unstable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow will tag all commits to the default branch with 'unstable'
# For more information see: https://docs.github.com/en/rest/git/refs?apiVersion=2022-11-28#update-a-reference

name: Tag Default Branch Commits with Unstable

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-22.04
timeout-minutes: 1

steps:
- uses: actions/checkout@v4
- name: Update unstable tag
uses: actions/github-script@v5
with:
script: |
github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/unstable',
force: true,
sha: context.sha
})

0 comments on commit 30c517c

Please sign in to comment.