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

Expected — Waiting for status to be reported after commit #188

Closed
aidan-melen opened this issue May 5, 2021 · 2 comments
Closed

Expected — Waiting for status to be reported after commit #188

aidan-melen opened this issue May 5, 2021 · 2 comments
Labels
type: question Further information is requested

Comments

@aidan-melen
Copy link

aidan-melen commented May 5, 2021

The objective of this workflow is to format the terraform source code and automatically commit these new changes to the branch.

note the is simply a modification of the recommend hashicorp workflow

name: Terraform

on:
  push:
    branches:
      - main
  pull_request:

jobs:

  lint:
    name: Lint, Auto Format, and Validate
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout
        uses: actions/checkout@master

      - name: Setup Terraform
        uses: hashicorp/setup-terraform@v1
        with:
          terraform_version: 0.13.5
          cli_config_credentials_hostname: 'example.org'
          cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}

      - name: Init
        id: init
        run: terraform init

      - name: Format
        id: format
        run: terraform fmt --recursive
      
      - name: Add and Commit Auto Format Changes
        uses: EndBug/add-and-commit@v7
        with:
          author_name: '@${{ github.actor }}'
          message: 'Auto Format Terraform code changes.'
          add: '.'

      - name: Validate
        id: validate
        run: terraform validate

Problem: The initial commit with the badly formatted code triggers this Lint, Auto Format, and Validate to run. Which will format the code and commit to the branch like we want. However, this new commit fails to retrigger the Lint, Auto Format, and Validate a second time. As a result, the Require Checks in the branch protection rule gets stuck waiting for the job to re-trigger from the auto commit, but it never does. Instead you just get this

Screen Shot 2021-05-05 at 3 21 36 PM

Why is the job not re-triggering on the commit from this github action???

@aidan-melen aidan-melen added the type: question Further information is requested label May 5, 2021
@EndBug
Copy link
Owner

EndBug commented May 6, 2021

The commit created by the action is not triggering further action runs because it has been made using the default GITHUB_TOKEN, which GitHub recognizes and ignores for CI runs
If you want it to trigger CI checks, you need to set up the repo with a custom PAT, you can do that with actions/checkout. My action uses the token the repo has been set up with, so there's no need to change any add-and-commit input.

Ref: https://github.com/EndBug/add-and-commit#tokens

Feel free to tell me if you need any further help!

@aidan-melen
Copy link
Author

The commit created by the action is not triggering further action runs because it has been made using the default GITHUB_TOKEN, which GitHub recognizes and ignores for CI runs
If you want it to trigger CI checks, you need to set up the repo with a custom PAT, you can do that with actions/checkout. My action uses the token the repo has been set up with, so there's no need to change any add-and-commit input.

Ref: https://github.com/EndBug/add-and-commit#tokens

Feel free to tell me if you need any further help!

Awesome, that makes sense. I will give that a try! Thanks for the recommendation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants