Giter Site home page Giter Site logo

bobheadxi / deployments Goto Github PK

View Code? Open in Web Editor NEW
364.0 7.0 61.0 31.32 MB

🔖 GitHub Action for working painlessly with deployment statuses

Home Page: https://github.com/marketplace/actions/github-deployments

License: MIT License

TypeScript 98.17% JavaScript 1.68% Makefile 0.14%
github-actions github-api deployments status

deployments's Introduction

GitHub Deployments View Action pipeline

bobheadxi/deployments is a GitHub Action for working painlessly with GitHub deployment statuses. Instead of exposing convoluted Action configuration that mirrors that of the GitHub API like some of the other available Actions do, this Action simply exposes a number of configurable, easy-to-use "steps" common to most deployment lifecycles.

📢 This project is in need of additional maintainers - if you are interested in helping out please let me know!

A simple example:

on:
  push:
    branches:
    - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - name: start deployment
      uses: bobheadxi/deployments@v1
      id: deployment
      with:
        step: start
        token: ${{ secrets.GITHUB_TOKEN }}
        env: release

    - name: do my deploy
      # ...

    - name: update deployment status
      uses: bobheadxi/deployments@v1
      if: always()
      with:
        step: finish
        token: ${{ secrets.GITHUB_TOKEN }}
        status: ${{ job.status }}
        env: ${{ steps.deployment.outputs.env }}
        deployment_id: ${{ steps.deployment.outputs.deployment_id }}

You can also refer to other projects that also use this action - you can find more usages of this action on Sourcegraph, or check out the following examples:

Also feel free to chime in on the show and tell discussion to share your usages of this Action!

Check out this blog post for a bit of background on the origins of this project.

Configuration

The following inputs configuration options are for all steps:

Variable Default Purpose
step One of start, finish, deactivate-env, or delete-env
token ${{ github.token }} provide your ${{ github.token }} or ${{ secrets.GITHUB_TOKEN }} for API access
env identifier for environment to deploy to (e.g. staging, prod, main)
repository Current repository target a specific repository for updates, e.g. owner/repo
logs URL to GitHub commit checks URL of your deployment logs
desc GitHub-generated description description for this deployment
ref github.ref Specify a particular git ref to use, (e.g. ${{ github.head_ref }})

step: start

This is best used on the push: { branches: [ ... ] } event, but you can also have release: { types: [ published ] } trigger this event. start should be followed by whatever deployment tasks you want to do, and it creates and marks a deployment as "started":

deploy started

In addition to the core configuration, the following inputs are available:

Variable Default Purpose
deployment_id Use an existing deployment instead of creating a new one (e.g. ${{ github.event.deployment.id }})
override false whether to mark existing deployments of this environment as inactive
payload JSON-formatted dictionary with extra information about the deployment
task 'deploy' change the task associated with this deployment, can be any string

The following outputs are available:

Variable Purpose
deployment_id ID of created GitHub deployment
status_id ID of created GitHub deployment status
env name of configured environment
Simple Push Example

on:
  push:
    branches:
    - main

jobs:
  deploy:
    steps:
    - name: start deployment
      uses: bobheadxi/deployments@v1
      id: deployment
      with:
        step: start
        env: release

    - name: do my deploy
      # ...


Simple Pull Request Example

on:
  pull_request:

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - name: start deployment
      uses: bobheadxi/deployments@v1
      id: deployment
      with:
        step: start
        env: integration

    - name: do my deploy
      # ...


step: finish

This is best used after step: start and should follow whatever deployment tasks you want to do in the same workflow. finish marks an in-progress deployment as complete:

deploy finished

In addition to the core configuration, the following inputs are available:

Variable Default Purpose
status provide the current deployment job status ${{ job.status }}
deployment_id identifier for deployment to update (see outputs of step: start)
env_url URL to view deployed environment
override true whether to manually mark existing deployments of this environment as inactive
auto_inactive false whether to let GitHub handle marking existing deployments of this environment as inactive (if and only if a new deployment succeeds).
Simple Example

# ...

jobs:
  deploy:
    steps:
    - name: start deployment
      # ... see previous example

    - name: do my deploy
      # ...

    - name: update deployment status
      uses: bobheadxi/deployments@v1
      if: always()
      with:
        step: finish
        token: ${{ secrets.GITHUB_TOKEN }}
        status: ${{ job.status }}
        env: ${{ steps.deployment.outputs.env }}
        deployment_id: ${{ steps.deployment.outputs.deployment_id }}


step: deactivate-env

This is best used on the pull_request: { types: [ closed ] } event, since GitHub does not seem to provide a event to detect when branches are deleted. This step can be used to automatically shut down deployments you create on pull requests and mark environments as destroyed:

env destroyed

Refer to the core configuration for available inputs.

Simple Example

on:
  pull_request:
    types: [ closed ]

jobs:
  prune:
    steps:
    # see https://dev.to/bobheadxi/branch-previews-with-google-app-engine-and-github-actions-3pco
    - name: extract branch name
      id: get_branch
      shell: bash
      env:
        PR_HEAD: ${{ github.head_ref }}
      run: echo "##[set-output name=branch;]$(echo ${PR_HEAD#refs/heads/} | tr / -)"

    - name: do my deployment shutdown
      # ...

    - name: mark environment as deactivated
      uses: bobheadxi/deployments@v1
      with:
        step: deactivate-env
        token: ${{ secrets.GITHUB_TOKEN }}
        env: ${{ steps.get_branch.outputs.branch }}
        desc: Environment was pruned

step: delete-env

This is the same as deactivate-env, except deletes the environment entirely. See step: deactivate-env for more details.

Note that the default GITHUB_TOKEN does not allow environment deletion - you have to set a personal access token with deployments:write and administration:write permissions and provide it in the token input.

Refer to the core configuration for available inputs.


Debugging

The argument debug: true can be provided to print arguments used by deployments and log debug information.

If you run into an problems or have any questions, feel free to open an issue or discussion!


Migrating to v1

bobheadxi/deployments@v1 makes the following breaking changes from v0.6.x:

  • CHANGED: no_override is now override, and the default behaviour is override: true in step: finish (step: start behaviour remains unchanged, but you can now set override: true on it now as well).
  • CHANGED: log_args is now debug, but does the same thing as before.
  • CHANGED: env is now always required. You can use env: ${{ steps.deployment.outputs.env }} to avoid repeating your env configuration.
  • REMOVED: transient - all deployments created by this action are transient by default, with removals handled by override, auto_inactive, or step: deactivate-env.
  • ADDED: step: delete-env deletes an environment entirely.

Then you can change your workflow to target the v1 tag, and automatically receive updates going forward:

- uses: bobheadxi/[email protected]
+ uses: bobheadxi/deployments@v1

Migrating to v1.2.0

The token configuration variable now has a default value so if you are happy with the default (${{ github.secret }}) you can simplify the action configuration by removing this from your actions.


deployments's People

Contributors

ai avatar alekseyleshko avatar allexveldman avatar awesomeunleashed avatar bobheadxi avatar buckett avatar bwdmonkey avatar codyleblanc avatar dependabot[bot] avatar devthejo avatar endbug avatar johncarter-phntm avatar krainboltgreene avatar louy avatar mtfurlan avatar mxcl avatar naartjie avatar nmccrina-contessa avatar nschonni avatar paullarsen-unlikely avatar shallwefootball avatar themightychris avatar theodorton avatar v3lop5 avatar ysndr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

deployments's Issues

Bump node version to 20

Hi!

Github deprecated Node 16 actions and started to display warnings requesting to update.

Not sure if it's just a version bump in action.yml or if it requires some deeper changes

Error: Unexpected error occurred: Not Found

When I attempt to run my deployment I get an error stating I am missing the deployment_id. I added this key to the start step using the github.event.deployment.id but this is null and does not actually have anything. So, I tried using something else and ended up landing on using the PR SHA. However, when I use that I get the error message that is this title. I tried several other id's, such as the github.event.pull_request.base.repo.id and other id values in the Github Context. Everything I try is this same error over and over. If I attempt to remove the deployment_id it gets mad at me and states that I need to have one. Is anyone else experiencing something similar to this?

Recently I've been seeing Warnings

Screen Shot 2020-05-30 at 3 10 07 PM

^ You can ignore the red error one, that's mine. Here's how I use deployment:
      - name: Flag Deployment in Github
        uses: bobheadxi/deployments@master
        id: deployment
        with:
          step: start
          token: ${{ secrets.GITHUB_TOKEN }}
          env: staging

and

      - name: Close deployment
        uses: bobheadxi/deployments@master
        with:
          step: finish
          status: success
          token: ${{ secrets.GITHUB_TOKEN }}
          deployment_id: ${{ needs.deploy_staging.outputs.deployment_id }}

Status of branch was not updated

Deployment was created in Environments, but I still have This branch has not been deployed in the pull request

Снимок экрана от 2022-08-12 03-03-17

on:
  push:
    branches:
      - main
  pull_request:
jobs:
  preview:
    runs-on: ubuntu-latest
    if: github.ref != 'refs/heads/main'
    steps:
      - name: Notify about new deployment
        uses: bobheadxi/deployments@v1
        id: deployment
        with:
          step: start
          token: ${{ secrets.GITHUB_TOKEN }}
          env: preview-${{ github.event.number }}
      - name: Deploy files
        id: deploy
        
      - name: Update deployment status
        uses: bobheadxi/deployments@v1
        with:
          step: finish
          token: ${{ secrets.GITHUB_TOKEN }}
          status: ${{ job.status }}
          env: ${{ steps.deployment.outputs.env }}
          env_url: ${{ steps.deploy.outputs.url }}
          deployment_id: ${{ steps.deployment.outputs.deployment_id }}

`step: delete-env` does not delete env

I create env by

      - name: Notify about new deployment
        uses: bobheadxi/deployments@v1
        id: deployment
        with:
          step: start
          token: ${{ secrets.GITHUB_TOKEN }}
          ref: ${{ github.head_ref }}
          env: preview-${{ github.event.number }}

Then I delete it by:

      - name: Clean from GitHub
        uses: bobheadxi/deployments@v1
        with:
          step: delete-env
          token: ${{ secrets.GITHUB_TOKEN }}
          env: preview-${{ github.event.number }}

But delete-env does not really delete env and only mark it as inactive.

Here is a log from GitHub Actions:

Run bobheadxi/deployments@v1
  with:
    step: delete-env
    token: ***
    env: preview-479
    debug: false
    auto_inactive: false
targeting ***/browsersl.ist
preview-479: found 1 existing deployments for env
preview-479.642582676: setting deployment (b04ae51d657ee0d1f192d7ae2659b791cbacc38b) state to "inactive"
preview-479: 1 deployments updated
preview-479.642582676: deleting deployment (b04ae51d657ee0d1f192d7ae2659b791cbacc38b)"
preview-479: 1 deployments deleted

But we still have preview-479 in the Environments page in Settings:

Снимок экрана от 2022-09-05 14-02-39

real ci and testing

I'm still using the tests from the template right now - should add some stuff to test the action's capabilities.

Add docs about permissions to fine-grained token

I created fine-grained token with access to a website repo and with deployments, environments, metadata, and content permissions.

But it failed on delete-env step because of the lack of permissions:

Run bobheadxi/deployments@v1
targeting ***/browsersl.ist
preview-490: found 2 existing deployments for env
preview-490.834080669: setting deployment (f188baad63570c539de0822405606d801f406259) state to "inactive"
preview-490.834079597: setting deployment (d30b4dddb858ef072d94955b8556f80ab0967443) state to "inactive"
preview-490: 2 deployments updated
preview-490.834080669: deleting deployment (f188baad63570c539de0822405606d801f406259)"
preview-490.834079597: deleting deployment (d30b4dddb858ef072d94955b8556f80ab0967443)"
preview-490: 2 deployments deleted
unexpected error encountered: HttpError: Resource not accessible by personal access token
Error: unexpected error encountered: HttpError: Resource not accessible by personal access token - see logs for more information

Here is a config:

name: Clean Preview
on:
  pull_request:
    types: [ closed ]
jobs:
  close:
    runs-on: ubuntu-latest
    steps:
      - name: Clean from GitHub
        uses: bobheadxi/deployments@v1
        with:
          step: delete-env
          token: ${{ secrets.DEPLOYMENTS_TOKEN }}
          env: preview-${{ github.event.number }}

HttpError: Resource not accessible by integration

When using v1, I encountered the following error.

Run bobheadxi/deployments@v1
initializing new deployment for production @ refs/heads/main
unexpected error encountered: HttpError: Resource not accessible by integration
Error: unexpected error encountered: HttpError: Resource not accessible by integration - see logs for more information

However, changing to v1.4.0 did not improve the issue.

Github Actions setting:

 - name: Start Deployment
   uses: bobheadxi/deployments@v1
   id: deployment
   with:
     step: start
     token: ${{ secrets.GITHUB_TOKEN }}
     env: production

make ref configurable

In some cases (e.g. deployment on pr) you want to set the ref to the pr so that the deployment will be displayed in your pr. Therefore it would be cool if the ref could be configured.

Deployment not associating with PR

First off... love this action. I've been using it across all projects since I came across it with zero issues.

I'm working on a new pipeline which is slightly different to my usual. These are the core differences I can identity:

  1. There are 4 different jobs. Two of them deploy to different environments (cms and frontend), each with their own start and finish steps.
  2. I'm using this single pipeline yaml file to handle both push and pull_request triggers. E.g.
on:
  push:
    branches:
      - master
      - qa
      - stage
      - production
  pull_request:
    branches:
      - master

The actual environments are showing up 100% fine within GitHub (outside of the Pull Request) but within the PR it's reporting no deployments:
image

Could you provide any insights into why this may be happening? Thanks!

when starting a deployment workflow fails with: HttpError: invalid json response body

below is a typical implementation for us :

We start a deployment:

    - name: start deployment
      uses: bobheadxi/deployments@v1
      if: inputs.DeployStage != ''
      id: deployment
      with:
        step: start
        token: ${{inputs.GithubToken}}
        env: ${{inputs.DeployStage}}/netlify/${{inputs.DeploymentName}}
        desc: ${{inputs.DeployMessage}}

then when done, we mark the deployment as done:

    - name: update deployment status
      uses: bobheadxi/deployments@v1
      if: inputs.DeployStage != ''
      with:
        step: finish
        token: ${{inputs.GithubToken}}
        status: ${{job.status}}
        env: ${{steps.deployment.outputs.env}}
        env_url: ${{steps.netlify.outputs.deploy_url}}
        deployment_id: ${{steps.deployment.outputs.deployment_id}}

We've now had to put in some esscape hatches into our workflows while we wait for your resposne (viz if: inputs.DeployStage != ''), otherwise we get the following error everytime.

Run bobheadxi/deployments@v1
  with:
    step: start
    token: ***
    env: pr/1123/netlify/AppStorybook
    desc: Deploy preview pr/1123
    debug: false
    auto_inactive: false
  env:
    NODE_OPTIONS: --max-old-space-size=8096
targeting REDACTED-ORG/REDACTED-REPO
initializing new deployment for pr/1123/netlify/AppStorybook @ refs/pull/1123/merge
created deployment REDACTED-ID for pr/1123/netlify/AppStorybook @ refs/pull/1123/merge
unexpected error encountered: HttpError: invalid json response body at https://api.github.com/repos/REDACTED-ORG/REDACTED-REPO/deployments/REDACTED-ID/statuses reason: Unexpected end of JSON input
Error: unexpected error encountered: HttpError: invalid json response body at https://api.github.com/repos/REDACTED-ORG/REDACTED-REPO/deployments/REDACTED-ID/statuses reason: Unexpected end of JSON input - see logs for more information

Why the rename to "main"? All our actions are now broken.. :/

Hi, We use your actions for deployments - and it works really great (big thanks for that btw!)

But please consider reverting the rename of "master" to "main" :( all of our builds are now failing and now we have to modify all of our repositories (50+) to update the actions with the new branch.

I say this here because I suspect we're not the only ones now facing this issue.

Many thanks
Dan

Should my description input display in the deployments view?

Hi. Based upon the documentation it seems you can provide a description using the "desc" input.

In the documentation here https://github.com/bobheadxi/deployments it looks like you have shown "This branch is being deployed". My assumption is that This branch is being deployed" is a description.

Should the desc input below display in the deployments view during this deployment?

thanks

  • name: GitHub Deployments
    uses: bobheadxi/deployments@master
    id: deployment
    with:
    step: start
    token: ${{ secrets.GITHUB_TOKEN }}
    env: dev
    desc: Starting a build and deploy JD

Default behaviour for auto_inactive doesn't work as expected

After upgrading from v0.6.2 to v1 we encountered a rate limiting issue with the default settings of, I've discussed this further here.

We attempted to resolve this by changing override to false and relying on the default setting of true for auto_inactive however this was only partially successful. We no longer get rate limited because there are no API calls being made to update the inactive deployments. However the status of the previous deployments are not getting updated, I believe this is because all deployments are now created with transient_environment: true.

As per the docs:

When you set the state of a deployment to success, then all prior non-transient, non-production environment deployments in the same repository with the same environment name will become inactive.

I created a simple pipeline here which shows the multiple active deployments here.

Is it possible to make transient_environment a configurable value again?

An “unexpected error encounterd” error on successful deploy

I would say more if I could, but there are no extra logs or anything. This error message is everything I got.

Three days ago, it worked as expected. Today I see this every time during successful deploys. The configuration is the same for months now.

It only breaks a development status update: it keeps showing the “in progress” state. Nothing more is affected.

It looks like this:
Error: unexpected error encounterd

Add support for passing a payload through?

We use payloads to include some important data, such as an AWS account ID to deploy to. It'd be great if we could pass in a payload input and have that be passed through in the GitHub API requests.

`no_override` option doesn't work and naming is confusing

Using

      # Create a GitHub deployment (within a GitHub environment), useful to keep a public track of all deployments directly in GitHub
      - name: Start GitHub deployment
        uses: bobheadxi/[email protected] # See https://github.com/bobheadxi/deployments
        id: start-github-deployment
        with:
          step: start
          token: ${{ secrets.GITHUB_TOKEN }}
          env: storybook # Uses "storybook" as GitHub environment name, because we don't need to manage multiple environments for storybook
          no_override: false # Disables auto marking previous environments as "inactive", as they're still active (Vercel deployments don't auto-deactivate) and it would remove the previous deployment links needlessly

It yields (see https://github.com/UnlyEd/next-right-now/runs/1756790711?check_suite_focus=true):

Warning: Unexpected input(s) 'no_override', valid inputs are ['token', 'step', 'auto_inactive', 'logs', 'desc', 'ref', 'env', 'transient', 'deployment_id', 'env_url', 'status']
##[debug]Loading env
Run bobheadxi/[email protected]
  with:
    step: start
    token: ***
    env: customer1-production
    no_override: false
  env:
    MANUAL_TRIGGER_CUSTOMER: 
    CUSTOMER_REF_TO_DEPLOY: customer1
initializing deployment  for customer1-production @ refs/heads/v2-mst-aptd-gcms-lcz-sty
found 2 existing deployments for env customer1-production - marking as inactive
setting deployment 'customer1-production.315946607' (c826034a4cb1152be631e309131d60865c34605a) state to "inactive"
setting deployment 'customer1-production.315943090' (afc2096b00102f18274315633f2394c4bfd5fa30) state to "inactive"
2 deployments updated
created deployment 315946665 for customer1-production @ refs/heads/v2-mst-aptd-gcms-lcz-sty
::set-output name=deployment_id::315946665
##[debug]steps.start-github-deployment.outputs.deployment_id='315946665'
::set-output name=env::customer1-production
##[debug]steps.start-github-deployment.outputs.env='customer1-production'
deployment status set to "in_progress"
##[debug]Node Action run completed with exit code 0
##[debug]Finishing: Start GitHub deployment

Warning: Unexpected input(s) 'no_override', valid inputs are ['token', 'step', 'auto_inactive', 'logs', 'desc', 'ref', 'env', 'transient', 'deployment_id', 'env_url', 'status']

found 2 existing deployments for env customer1-production - marking as inactive

The no_override option isn't recognized and probably ignored. Thus, specifying it doesn't change anything and it doesn't do what it should.

Also, the naming is highly confusing, and makes the code hard to understand.

deployments/src/main.ts

Lines 23 to 33 in f8bee07

const noOverride = core.getInput('no_override') !== 'false';
const transient = core.getInput('transient') === 'true';
const gitRef = core.getInput('ref') || ref;
let deploymentID = core.getInput('deployment_id');
console.log(`initializing deployment ${deploymentID} for ${environment} @ ${gitRef}`);
// mark existing deployments of this environment as inactive
if (!noOverride) {
await deactivateEnvironment(client, repo, environment);
}

It should be renamed as something like auto_deactivate, something of the sort.

I'm still confused at whether you meant it to automatically deactivate old deployments, by reading the code I'd say it doesn't auto-deactivate by default, but it does.

Warning: The `set-output` command is deprecated and will be disabled soon

Recently this action started to indicate the following warning message.

Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

I found the solution in this discussion
https://github.com/orgs/community/discussions/35994

Basically you should output to $GITHUB_OUTPUT and stop using set-output command.
https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter

Example:

      - name: Set color
        id: random-color-generator
        run: echo "SELECTED_COLOR=green" >> $GITHUB_OUTPUT
      - name: Get color
        run: echo "The selected color is ${{ steps.random-color-generator.outputs.SELECTED_COLOR }}"

Deployment status in PR not starting or updating

I'm not quite sure what is causing this as this configuration has worked before. There's nothing particularly complicated about it and looks similar to the examples given here.

To add to the mystery, the deployment can be seen under Deployments/History but the PR deployment status is stuck in This branch has not been deployed.

Steps are as follows and job throws no warnings or errors.

Start

    - name: Start
      uses: bobheadxi/deployments@v1
      id: status
      with:
        step: start
        token: ${{ secrets.GITHUB_TOKEN }}
        env: staging

Debug output:

targeting ***/***
'start' arguments {
  stepArgs: { deploymentID: '', override: false, payload: undefined },
  coreArgs: {
    environment: 'staging',
    description: '',
    logsURL: 'https://github.com/***/***/commit/***/checks'
  }
}
initializing new deployment for staging @ refs/pull/10/merge
created deployment 783773500 for staging @ refs/pull/10/merge
created deployment status 1627565500 with status "in_progress"

Finish

    - name: Finish
      uses: bobheadxi/deployments@v1
      with:
        step: finish
        override: false
        auto_inactive: false
        token: ${{ secrets.GITHUB_TOKEN }}
        status: ${{ job.status }}
        env: ${{ steps.status.outputs.env }}
        deployment_id: ${{ steps.status.outputs.deployment_id }}
        env_url: ***

Debug output:

Run bobheadxi/deployments@v1
  with:
    step: finish
    override: false
    auto_inactive: false
    token: ***
    status: success
    env: staging
    deployment_id: 783773500
    env_url: ***
    debug: true
  env:
    AWS_ACCESS_KEY_ID: ***
    AWS_SECRET_ACCESS_KEY: ***
    BRANCH: testbranch
targeting ***/***
'finish' arguments {
  stepArgs: {
    status: 'success',
    deploymentID: '783773500',
    envURL: '***',
    override: false,
    autoInactive: false
  },
finishing deployment for 783773500 with status success
  coreArgs: {
    environment: 'staging',
    description: '',
    logsURL: 'https://github.com/***/***/commit/***/checks'
  }
}
783773500 status set to success { statusID: 1627565500 }

README examples not up to date

  1. At creation:
  • when passing:
id: deployment

warning is thrown:

Warning: Unexpected input(s) 'id', valid inputs are ['token', 'step', 'auto_inactive', 'logs', 'desc', 'ref', 'env', 'transient', 'deployment_id', 'env_url', 'status']

Warning: The set-output command is deprecated and will be disabled soon.

Hi, we are using bobheadxi/deployments@master in our github actions.

During investigations into reason of Warning: The set-output command is deprecated and will be disabled soon. warning, we found that

Run bobheadxi/deployments@master
Warning: The set-output command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

Do you have any plan to fix it?

Pull requests from dependabot throw Error: unexpected error encounterd: Resource not accessible by integration

Hello,

when using this action I sometimes receive an error message like

Error: unexpected error encounterd: Resource not accessible by integration

Logs copied from this failed run:

Run bobheadxi/[email protected]
  with:
    step: start
    token: ***
    logs: https://github.com/fhac-ewi/grid-optimizer/pull/82/checks
    env: PR #82 Review
    ref: dependabot/npm_and_yarn/src-frontend/types/node-15.3.0
    no_override: true
initializing deployment  for PR #82 Review @ dependabot/npm_and_yarn/src-frontend/types/node-15.3.0
Error: unexpected error encounterd: Resource not accessible by integration

Using this configuration in my workflow file:

      - name: Create GitHub deployment
        uses: bobheadxi/[email protected]
        id: deployment
        with:
          step: start
          token: ${{ secrets.GITHUB_TOKEN }}
          logs: "https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}/checks"
          env: "PR #${{ github.event.pull_request.number }} Review"
          ref: ${{ github.head_ref }}

When I use re-run all jobs this action works without an error. For example this successful run.

Run bobheadxi/[email protected]
  with:
    step: start
    token: ***
    logs: https://github.com/fhac-ewi/grid-optimizer/pull/82/checks
    env: PR #82 Review
    ref: dependabot/npm_and_yarn/src-frontend/types/node-15.3.0
    no_override: true
initializing deployment  for PR #82 Review @ dependabot/npm_and_yarn/src-frontend/types/node-15.3.0
created deployment 365549354 for PR #82 Review @ dependabot/npm_and_yarn/src-frontend/types/node-15.3.0
deployment status set to "in_progress"

Any ideas?

multiple url in finish

Is there a way (in case of a repository deploys various URLs, such as API, WWW, etc.) to specify multiple URLs in the finish step? The goal is to be able to test a whole environment that can consist of multiple URLs.

Error on PRs from Forks: "unexpected error encounterd: Resource not accessible by integration"

We're getting errors when the step runs against PR's issued from Forks. This works fine for PR's from branches in the same repo.

Step we're using is:

      - name: start deployment
        uses: bobheadxi/[email protected]
        id: deployment
        with:
          step: start
          token: ${{ secrets.GITHUB_TOKEN }}
          env: ${{ fromJSON('["Production", "Preview"]')[github.ref != 'refs/heads/main'] }} 

You can see an example here: https://github.com/Sitecore/developer-portal/pull/152/checks?check_run_id=3761659282

Seemed related to #32, but I added the fix from there to use the following permissions on the job but it didn't fix it:

permissions: 
  deployments: write

You can see our full GH action definition here: https://github.com/Sitecore/developer-portal/blob/main/.github/workflows/deploy.yml

Example of failed run: https://github.com/Sitecore/developer-portal/pull/152/checks?check_run_id=3761659282

'status is not defined' with v0.5.0

Hi @bobheadxi,

our pipelines are failing with the newest version. I checked the release notes and saw no breaking change there. So I assume it is a bug:

Run bobheadxi/deployments@master
  with:
    step: finish
    token: ***
    status: success
    deployment_id: ***
    env_url: https://test.example.com
    no_override: true
  env:
    CI: true
Error: unexpected error encounterd: status is not defined

I guess it is because we're trying to access job.status, like this: status: ${{ job.status }}

Input required and not supplied: deployment_id

I am updating this to version 1 and am having trouble with the deployment_id. I have tried many combinations of values for it and I cannot seem to get this to work. I have tried (or thought I did) what the docs explain, as well as trying other values. The closest I've got is just by hardcoding a value (eg 123) as the deployment_id, but that throws other errors.

Here is my current config

 steps:
      - uses: actions/checkout@v3
      - name: Start Web Preview Deployment
        uses: bobheadxi/deployments@v1
        id: deployment
        with:
          step: start
          token: ${{ secrets.GITHUB_TOKEN }}
          env: ${{ fromJSON('["Production", "Preview"]')[github.ref != 'refs/heads/main'] }}
          deployment_id: ${{ github.event.deployment.id }}
      - name: Web Preview Build
        uses: actions/setup-node@v1
        with:
          node-version: "14.x"
      - name: Deploy
        ... deploy steps
      - name: Update Web Preview Deployment Status
        uses: bobheadxi/deployments@v1
        if: always()
        with:
          step: finish
          token: ${{ secrets.GITHUB_TOKEN }}
          status: ${{ job.status }}
          env: ${{ fromJSON('["Production", "Preview"]')[github.ref != 'refs/heads/main'] }}
          deployment_id: ${{ github.event.deployment.id }}
          debug: true

The output for the debug is

Run bobheadxi/deployments@v1
  with:
    step: finish
    token: ***
    status: failure
    env: Preview
    debug: true
    auto_inactive: false

deployment_id isnt there. Its there if I hard code 123 but my suspicion is that what Im using for the deployment_id isnt a thing.

When I try a value that shows up in debug (eg deployment_id: ${{ github.ref }}), I get the following error

Preview: found 100 existing deployments for env
Preview.1251784709: setting deployment (1dd4c5b78a8100f2d44b56ef848fc652ce3bb144) state to "inactive"
Preview.1251784709 is already inactive; skipping.

Any help would be appreciated 🙏

Where can I see the description?

Hi, I am using the desc parameter to set my own description.
Now I wonder where I can see this description?

When I go to actionsdeployments then I see only: 973491a was [deployed] by MyUser 2 minutes ago

logs & my input:

Run bobheadxi/[email protected]
  with:
    step: finish
    token: ***
    env: ps
    status: success
    deployment_id: 1002556365
    desc: Finished deploy image [my-app:my-tag] on stage [test]
    debug: false
    auto_inactive: false

Unexpected error encountered: HttpError: Not Found when using "delete-env"

I am getting an error Unexpected error encountered: HttpError: Not Found during the delete-env step.

Here's the full logs:

Run bobheadxi/[email protected]
  with:
    step: delete-env
    token: ***
    desc: Environment was pruned
    env: pulumi-service-pr-51
    debug: true
    auto_inactive: false
targeting <redacted>/pulumi-service
'delete-env' arguments {
  coreArgs: {
    environment: 'pulumi-service-pr-51',
    description: 'Environment was pruned',
    logsURL: 'https://github.com/<redacted>/pulumi-service/commit/0f30981[2](https://github.com/<redacted>/pulumi-service/runs/5382231462?check_suite_focus=true#step:6:2)984b6eacbe7ee8f89ce5d9da2[3](https://github.com/<redacted>/pulumi-service/runs/5382231462?check_suite_focus=true#step:6:3)0a3b30/checks'
  }
}
unexpected error encountered: HttpError: Not Found
Error: unexpected error encountered: HttpError: Not Found - see logs for more information

Not sure why this is happening? I can confirm that a deployment matching that environment does exist for this repo.

env input is throwing a warning even though is documented as supported

I set the env: input, but I got ##[warning]Unexpected input(s) 'env', valid inputs are ['token', 'step', 'auto_inactive', 'logs', 'desc', 'ref']. On the readme there is an example with using that input.

The same happens for status and development_id throwing ##[warning]Unexpected input(s) 'status', 'deployment_id', valid inputs are ['token', 'step', 'auto_inactive', 'logs', 'desc', 'ref']

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.