Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: src/layouts/Default.astro
pubDate: 2023-01-01
modDate: 2024-11-21
modDate: 2026-09-15
title: GitHub Actions
description: Integrating Octopus Deploy into your GitHub Action workflows
icon: fa-brands fa-github
Expand Down Expand Up @@ -79,8 +79,8 @@ jobs:
with:
project: 'MyProject'
release_number: '1.0.0'
git_ref: ${{ github.ref }}
git_commit: ${{ github.sha }}
git_ref: ${{ github.head_ref || github.ref }}
git_commit: ${{ github.event.pull_request.head.sha || github.sha }}

# Action to Deploy a Release
- name: Deploy a release in Octopus Deploy 🐙
Expand All @@ -96,6 +96,10 @@ jobs:
Fizz: Buzz
```

:::div{.hint}
On a pull request, `github.ref` is `refs/pull/<number>/merge` and `github.sha` is the merge commit that GitHub creates for the pull request. That commit does not exist on any branch, so a release pinned to it can fail to deploy later. Use `github.head_ref` and `github.event.pull_request.head.sha` instead, as shown above. Both fall back to the push values on every other event.
:::

### ✍️ Environment variables

| Name | Description |
Expand Down Expand Up @@ -183,8 +187,8 @@ jobs:
with:
project: 'MyProject'
release_number: '1.0.0'
git_ref: ${{ github.ref }}
git_commit: ${{ github.sha }}
git_ref: ${{ github.head_ref || github.ref }}
git_commit: ${{ github.event.pull_request.head.sha || github.sha }}
packages: |
HelloPackage:1.0.0
```
Expand Down Expand Up @@ -267,8 +271,8 @@ jobs:
with:
project: 'MyProject'
release_number: '1.0.0'
git_ref: ${{ github.ref }}
git_commit: ${{ github.sha }}
git_ref: ${{ github.head_ref || github.ref }}
git_commit: ${{ github.event.pull_request.head.sha || github.sha }}
packages: |
HelloPackage:1.0.0
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: src/layouts/Default.astro
pubDate: 2023-01-01
modDate: 2026-07-20
modDate: 2026-09-15
title: Creating releases from a build server plugin on a version-controlled project
description: Examples of how to ensure that the right branch is used to create the release when using a build server plugin.
navOrder: 45
Expand Down Expand Up @@ -51,10 +51,10 @@ ${{ github.head_ref || github.ref }}
For *Git Commit*, use

```text
${{ github.event.push.after || github.event.pull_request.head.sha }}
${{ github.event.pull_request.head.sha || github.sha }}
```

**Note:** this approach doesn't populate the commit details for manually triggered runs. It is recommended that you provide the values for both branch and commit in this case.
On a pull request this resolves to the head of the source branch. On every other event, including manually triggered runs, it falls back to `github.sha`.

## TeamCity

Expand Down