-
-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (31 loc) · 963 Bytes
/
tag.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Copyright © Michal Čihař <[email protected]>
#
# SPDX-License-Identifier: MIT
#
name: Weekly tag
on:
schedule:
- cron: 0 10 * * 0
workflow_dispatch:
permissions:
contents: write
jobs:
tag:
runs-on: ubuntu-24.04
steps:
- name: 🏷️ Create/update tag
uses: actions/github-script@v7
with:
github-token: ${{ secrets.WEBLATE_CI_TOKEN }}
script: |
const now = new Date;
const onejan = new Date(now.getFullYear(), 0, 1);
/* This is not a ISO-8601 week number but works well for versioning */
const week = Math.ceil((((now.getTime() - onejan.getTime()) / 86400000) + onejan.getDay() + 1) / 7);
const result = await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/v${ now.getFullYear() }.${ week }.0`,
sha: context.sha
});
console.log(result);