|
1 | 1 | name: Build and Test
|
2 | 2 |
|
3 | 3 | on:
|
| 4 | + pull_request: |
| 5 | + paths-ignore: |
| 6 | + - "**.md" |
4 | 7 | push:
|
5 | 8 | branches:
|
| 9 | + - master |
6 | 10 | - release/**
|
7 |
| - pull_request: |
8 |
| - types: |
9 |
| - - opened |
10 |
| - - synchronize |
11 |
| - - reopened |
| 11 | + paths-ignore: |
| 12 | + - "**.md" |
| 13 | + |
12 | 14 |
|
13 | 15 | env:
|
14 | 16 | # Variables defined in the repository
|
@@ -38,16 +40,34 @@ jobs:
|
38 | 40 | with:
|
39 | 41 | fetch-depth: 0
|
40 | 42 |
|
41 |
| - - name: Extract docker tag from action.yml |
| 43 | + - name: Set git user to getsentry-bot |
| 44 | + if: github.ref == 'refs/heads/master' |
42 | 45 | run: |
|
43 |
| - TAG=$(yq '... | select(has("uses") and .uses | test("docker://ghcr.io/getsentry/action-release-image:.*")) | .uses' action.yml | awk -F':' '{print $3}') |
44 |
| - echo "DOCKER_TAG=$TAG" >> $GITHUB_ENV |
45 |
| - |
46 |
| - if [[ "${{ github.event_name }}" == "pull_request" ]]; then |
47 |
| - if [[ "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
48 |
| - echo "Error: DOCKER_TAG $TAG matching format MAJOR.MINOR.PATCH is not allowed inside pull requests." |
49 |
| - echo "Please rename the docker tag in action.yml and try again." |
50 |
| - exit 1 |
| 46 | + echo "GIT_COMMITTER_NAME=getsentry-bot" >> $GITHUB_ENV; |
| 47 | + echo "GIT_AUTHOR_NAME=getsentry-bot" >> $GITHUB_ENV; |
| 48 | + echo "[email protected]" >> $GITHUB_ENV; |
| 49 | +
|
| 50 | + - name: Evaluate docker tag |
| 51 | + run: | |
| 52 | + if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then |
| 53 | + echo "DOCKER_TAG=master" >> $GITHUB_ENV |
| 54 | + yarn run set-docker-tag master |
| 55 | + |
| 56 | + if ! git diff --quiet action.yml; then |
| 57 | + git add action.yml |
| 58 | + git commit -m "chore: Set docker tag for master [skip-ci]" |
| 59 | + git push |
| 60 | + fi |
| 61 | + else |
| 62 | + TAG=$(yq '... | select(has("uses") and .uses | test("docker://ghcr.io/getsentry/action-release-image:.*")) | .uses' action.yml | awk -F':' '{print $3}') |
| 63 | + echo "DOCKER_TAG=$TAG" >> $GITHUB_ENV |
| 64 | + |
| 65 | + if [[ "${{ github.event_name }}" == "pull_request" ]]; then |
| 66 | + if [[ "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
| 67 | + echo "Error: DOCKER_TAG $TAG matching format MAJOR.MINOR.PATCH is not allowed inside pull requests." |
| 68 | + echo "Please rename the docker tag in action.yml and try again." |
| 69 | + exit 1 |
| 70 | + fi |
51 | 71 | fi
|
52 | 72 | fi
|
53 | 73 |
|
|
0 commit comments