-
Notifications
You must be signed in to change notification settings - Fork 1
32 lines (30 loc) · 997 Bytes
/
tag-pr.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
name: Tag PR
on:
pull_request:
types: closed
jobs:
tag:
# This could be flaky for forks - need to check both repos are the same but PR11 skipped with that check and YAGNI right now
if: github.event.pull_request.merged
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: create tag git ref
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/pr${{ github.event.number }}',
sha: '${{ github.event.pull_request.head.sha }}'
}).catch(err => {
if (err.status !== 409) throw err;
github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/pr${{ github.event.number }}',
sha: '${{ github.event.pull_request.head.sha }}'
});
})