Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The branch parameter is not defaulted to the branch that triggers a workflow #97

Open
apeacock1991 opened this issue Jul 4, 2023 · 7 comments

Comments

@apeacock1991
Copy link

Based on the documentation, if you omit branch, it should default to the branch for the workflow.

I omitted the parameter, but it always reported deployments in the dashboard to master. Passing the branch using branch: ${{ github.ref_name }} fixed this, but the docs either need updating or the code fixing.

edmundmiller added a commit to edmundmiller/edmundmiller.dev that referenced this issue Aug 9, 2023
@davidlj95
Copy link

davidlj95 commented Sep 18, 2023

Had the same issue. However, did something a bit different to OP as workaround:

github.ref_name in a pull request refers to the pull request merge branch. Something like 42/merge. Where 42 is the PR number.

So instead, I've used:

branch:  ${{ github.head_ref || github.ref_name }}

github.head_ref refers to the base branch if being triggered in a pull request (i.e. feat-do-some-work). And if not a pull request, assume it's a push workflow and then github.ref_name is the branch that was pushed (i.e. main).

Indeed github.head_ref || github.ref_name is what the action actually tries to do

@davidlj95
Copy link

davidlj95 commented Sep 18, 2023

Btw I'm using reusable workflows. Maybe that's the source of the issue

@richardscarrott
Copy link

richardscarrott commented Sep 26, 2023

I ran into the same issue (not using reusable workflows). Without setting the branch in config, deploys run on pull_request were all named HEAD.

Setting to branch: ${{ github.head_ref || github.ref_name }} gives me the source branch on pull_request and the branch name on push 🙌

@p4block
Copy link

p4block commented Oct 18, 2023

Same problem for me, fixed by the previous comment. Here's my full config for future ref:

      - name: Build web
        run: |
          if [ "$GITHUB_REF_NAME" == "main" ]; then
            npm run build:web:prod
          elif [ "$GITHUB_REF_NAME" == "staging" ]; then
            npm run build:web:staging
          else 
            npm run build:web
          fi

      - name: Publish site
        uses: cloudflare/pages-action@v1
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          projectName: ${{ matrix.cf-project }}
          directory: www
          gitHubToken: ${{ secrets.GITHUB_TOKEN }}
          branch:  ${{ github.head_ref || github.ref_name }}

jaydrogers added a commit to serversideup/docker-php that referenced this issue Nov 16, 2023
@harryzcy
Copy link

Also, when the event is triggered by pushing a tag, the Cloudflare deployments just show HEAD

@tien
Copy link

tien commented Dec 14, 2023

Got this exact same issue

tien added a commit to TalismanSociety/talisman-web that referenced this issue Dec 14, 2023
tien added a commit to TalismanSociety/talisman-web that referenced this issue Dec 14, 2023
jaydrogers added a commit to serversideup/docker-php that referenced this issue Feb 5, 2024
* Improved query accuracy

* Removed sort

* Removed version data

* Changed docker repo

* Restructured docker repository name

* Moved readme control to beta for now

* Improved error handling

* Removed unset check

* Added dev script

* Removed copy command

* Fixed merging of YML

* Disabled debugging

* Fixed merge

* Remove debug

* Improved dependency install

* Fixed structure of dev command

* Improved documentation

* Initial commit of S6

* Initial commit of other variations

* Added early exits

* Fixed separation of commands

* Added init script

* Removed whitespace

* Sort scripts to run by numerical order

* Fixed execution of commands

* Improved development script

* Removed debug

* WIP migrated FPM and NGINX over

* Removed wget dependency

* Fixed reference to php-fpm

* Changed shells

* Fixed dependency installer

* WIP - adding nginx

* Converted logic to shell

* Added trace

* Working NGINX

* Working NGINX-FPM

* Working Alpine support

* Functioning Alpine image

* Added special thanks

* Cleaned up error output

* Removed whitespace

* Fixed error reference

* Remove unnecessary code

* WIP Nginx Unit

* Set script name

* Renamed nginx-unit to unit

* Fixed base image reference

* Improved error output

* Working NGINX Unit with SSL-Off

* Cleaned up output

* Explicit script names

* Added debug

* WIP Unit Mixed

* Renamed SSL to self-signed

* Working SSL configuration

* Changed to serversideup/php

* Changed docker-php-pro to docker-php-serversideup

* Fixed illegal character error

* Added minimum TLS

* Updated ciphers

* Working NGINX Unit configuration

* Changed name reference

* Changed branch name for beta

* Added usage notes

* Refactored tag script

* Renamed base config file

* Renamed base config

* Moved RC and added usage instructions

* Removed whitespace

* Removed whitespace

* Require base config

* Clarified defaults

* Renamed DEPENDENCY_PACKAGES_BOOKWORM to DEPENDENCY_PACKAGES_DEBIAN

* Refactored and improved readability

* Added base operating systems

* Updated php-version.yml structure

* Added base os for RC

* Refactored assemble-docker-tags

* Adjusted Base OS Logic

* Fixed variable name

* Variable name change

* Pretty print

* Changed permissions

* Added help menu

* Fixed help menu

* Remove help tag

* Added fpm configs

* Added default variables

* Organized and renamed variables for better clarity

* Remove PHP open base dir

* Fixed permissions on configs

* Moved PHP_SESSION_COOKIE_SECURE to ini. Fixes #105. Ref #107

* Moved init scripts to be at a higher number

* Added PHP_ERROR_LOG

* Changed order of execution for debug

* Changed debug output order

* Removed default base os

* Prepared for push of images

* Default to any debian os

* Updated landing page

* Updated readme

* Improved NGINX Unit description

* Updated features

* Improved output

* Added newer versions

* Added build process

* Removed fpm-apache for now

* Updated NGINX Unit version to 1.31.1

* Added variations from config file

* Fixed tagging issues for default_base_os

* Added comment for why we can't include an alpine version of Unit

* Ignore DS_Store files

* Added PHP extensions

* Removed whitespace

* Commented out sqllit

* Specified branch due to cloudflare/pages-action#97

* Update s6-overlay version to v3.1.6.2

* Updated comparison and moved S6 overlay to its own page

* Added APP_BASE_DIR

* Clarified release notes location

* Started migration guide

* Removed whitespace

* Update migration guide with v3 changes

* Updated Laravel automations

* Fixed heading reference

* Add branch parameter to Cloudflare deployment

* Cleaned up GitHub Action names

* Added skip-download option

* Temporarily set skip download

* Add expanded Laravel automations

* Clarified output

* Fix autorun Laravel migration to true

* Update PHP Docker Images and Add New Features

* Clarified comment

* Enabled downloads again

* Add PHP 8.3 with Alpine and Bookworm support

* Default to 8.3

* Added debug mode

* Moved debug mode to entrypoint

* Update Dockerfile and entrypoint scripts

* Added labels and ability to set repo versions

* Adjusted argument order

* Update environment variable specification

* Update REPOSITORY_BUILD_VERSION to include GIT
Short SHA and GitHub Run ID

* Update Dockerfile comments for CLI and FPM
variations

* Update PHP Docker Images description

* Add explanation for "Optimized for Laravel &
WordPress" in getting started guide

* Simplified checkout process

* Added ability to push to GHCR

* Add multi-arch support and published registry URLs

* Remove Discourse link

* Updated installation instructions

* Update upgrade guide with version selection
details

* Add links to view available images and tags

* Update installation.md with information about
selecting the version of PHP

* Update link to guide on selecting the right image

* Updated contribution guide

* Update docker-compose.yml to include .dockerignore
file

* Add composer support

* Set S6 Overlay version in variable instead of file

* Update project credits and special thanks

* Update title in marketing layout

* Adjusted default PHP extensions

* Added $build_major_version-$build_base_os tag

* Add default entrypoint scripts and disable default
configuration

* Fix typo in default configurations

* Add guide for migrating from official PHP Docker
images

* Fix missing image tag and add link to installation
guide

* Update PHP image migration guide

* Add default environment variable specification

* Add guide on changing common PHP settings

* Remove customizing the image guide

* Add migration guide from v2 to v3

* Update Docker Compose and add Dockerfile for
installing additional PHP extensions

* Fix image tag not found issue in older versions of
PHP

* Add instructions for rebuilding Docker image on
Docker Compose initialization

* Add install-php-extensions support

* Refactor Docker tag generation logic

* WIP of SSL and start up scripts

* Docs Upgrade (#245)

* Upgraded to Nuxt 3.8

* Added about images and content ref #238

* Updated to H1 Title

* Removed methods for SEO data

* Added OG Image template

* Cleaned up SEO

* Fixed undefined page variable

* Added sign up form

* Added nvm

* Add Node.js setup and update build process

* Update link to customizations guide

* Update environment name in marketing site preview
workflow

* Updated to base 64

* Update environment name in
action_marketing-site-publish.yml

* Add BASE_PATH to .env.example

* Add SSL configuration options

* Update SSL configuration options

* Update ogImage and twitterImage URLs in marketing
layout

* Allow for nuxt base url to be null

* Adjusted w and h of image

---------

Co-authored-by: Jay Rogers <jay@521dimensions.com>

* Update SSL configuration

* Updated logo

* Update PHP patch versions

* Fixed code highlights

* Update SSL configuration and provide examples for
self-signed and custom certificates

* Add note about php.ini in
changing-common-php-settings.md

* Update Dockerfile versions and install additional
PHP extensions

* Add guide for adding custom startup scripts

* Organized variables better

* Update migration guide with v3 changes

* Update PHP installation instructions and remove
deprecated features

* Removed arrow for compatibility reasons

* Update link to discussion

* Update PHP Docker Images with improved
customization

* Added PHP 8.3 support

* Update description in index.md file

* Update description of serversideup/php Docker
images

* Update PHP Docker Images name

* Changed to PNG image

* Update ogImageHeight in marketing layout

* Update ogDescription and twitterDescription in
marketing layout

* Update social image file type

* Update social image

* Adjusted OG image template

* Adjusted borders

* Update border and rounded styles in OgImage
component

* Update command reference in PHP Docker image

* Updated favicon Url ref #251

* Add PHP_OPEN_BASEDIR environment variable to Dockerfiles. Fixes #258

* Add port exposure for HTTP and HTTPS. Fixes #260

* Add PHP_MAX_INPUT_TIME environment variable. Fixes #257

* Added ZIP to Debian images. Fixes #261

* Add WORKDIR instruction. Fixes #263

* Update environment names for marketing site workflows

* Test CI

* CI test 2

* Revert environment names

* Cleaned up environment names

* CI test 1

* Remove testing

* Update PHP_EXT_INSTALLER_VERSION to 2.1.71

* Update PHP_EXT_INSTALLER_VERSION to 2.1.73

* Update Docker actions to latest versions

* Add prefix option for Docker image tag

* Add composer cache directory creation and ownership

* Added docker-php-serversideup-set-id script

* Removed --chown flag. Fixes #265

* Added video embed component

* Added Book & updated header

* Fix typo

* Fixed code execution

* Improved s6-init build process

* Added Dockerfile support

* Added S6 overlay script customization

* Add book recommendation for building multi-platform browser extensions

* Update menu link to Bugflow and change "Books" to "Products"

* Added automated checks to ensure database connection is alive before running migrations

* Added AUTORUN_LARAVEL_MIGRATION_TIMEOUT. Default timeout of 30 seconds

* Update PHP_EXT_INSTALLER_VERSION to 2.1.76

* Improved test connection to database. Fixes #279

* Upgraded to actions/checkout@v4

* Prepare for merge

* Update PHP patch versions in base config

---------

Co-authored-by: Dan Pastori <dan@521dimensions.com>
@druvv
Copy link

druvv commented May 19, 2024

I have this issue as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants