Skip to content

Cancel workflows for previous commits in a PR when new commits are pushed #867

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

Merged
merged 6 commits into from
Mar 17, 2022

Conversation

sunmou99
Copy link
Contributor

@sunmou99 sunmou99 commented Mar 15, 2022

Description

To save the runner resource, use concurrency to prevent previous workflows from running. This can occur in PRs where the author raises multiple commits in quick succession.


Testing

Previous commits cancelled:
https://github.com/firebase/firebase-cpp-sdk/actions/runs/1994908024
https://github.com/firebase/firebase-cpp-sdk/actions/runs/1994908021
https://github.com/firebase/firebase-cpp-sdk/actions/runs/1994908019


Type of Change

Place an x the applicable box:

  • Bug fix. Add the issue # below if applicable.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

Notes

  • Bug fixes and feature changes require an update to the Release Notes section of release_build_files/readme.md.
  • Read the contribution guidelines CONTRIBUTING.md.
  • Changes to the public API require an internal API review. If you'd like to help us make Firebase APIs better, please propose your change in a feature request so that we can discuss it together.

@sunmou99 sunmou99 added the skip-release-notes Skip release notes check label Mar 15, 2022
@sunmou99 sunmou99 added the tests-requested: quick Trigger a quick set of integration tests. label Mar 16, 2022
@sunmou99 sunmou99 marked this pull request as ready for review March 16, 2022 18:02
@sunmou99 sunmou99 removed the tests-requested: quick Trigger a quick set of integration tests. label Mar 16, 2022
@sunmou99 sunmou99 closed this Mar 16, 2022
@sunmou99 sunmou99 reopened this Mar 16, 2022
@sunmou99 sunmou99 changed the title Test GitHub Concurrency Cancel workflows for previous commits in a PR when new commits are pushed Mar 16, 2022
@sunmou99 sunmou99 requested review from dconeybe and jonsimantov and removed request for jonsimantov and dconeybe March 16, 2022 20:18
@sunmou99 sunmou99 force-pushed the feature/cancel-workflows branch 2 times, most recently from eee4f23 to b503d17 Compare March 16, 2022 20:23
@jonsimantov
Copy link
Contributor

Making sure I understand how this works - if a previous job in the same concurrency group is running, the new job will cancel it?

Is github.head_ref the name of the branch or the sha? What about github.ref? (Obviously if it uses the SHA, it won't have the same concurrency group, right?)

@sunmou99 sunmou99 force-pushed the feature/cancel-workflows branch from b503d17 to ffa3d6f Compare March 16, 2022 22:35
@sunmou99
Copy link
Contributor Author

sunmou99 commented Mar 16, 2022

@jonsimantov
Yes.

Making sure I understand how this works - if a previous job in the same concurrency group is running, the new job will cancel it?

Both github.head_ref and github.ref are names, e.g. 'refs/heads/main'. https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
github.head_ref is only defined on pull_request events.

Is github.head_ref the name of the branch or the sha? What about github.ref? (Obviously if it uses the SHA, it won't have the same concurrency group, right?)

@dconeybe
Copy link
Contributor

I have near-zero experience with GitHub workflows so I don't have anything to contribute. But thank you for implementing this!

@sunmou99 sunmou99 requested a review from cynthiajoan March 17, 2022 17:39
@sunmou99 sunmou99 merged commit 96f12db into main Mar 17, 2022
@sunmou99 sunmou99 deleted the feature/cancel-workflows branch March 17, 2022 17:40
@github-actions github-actions bot added the tests: in-progress This PR's integration tests are in progress. label Mar 17, 2022
@github-actions
Copy link

github-actions bot commented Mar 17, 2022

Integration test with FLAKINESS (succeeded after retry)

Requested by @sunmou99 on commit 96f12db
Last updated: Thu Mar 17 13:19 PDT 2022
View integration test log & download artifacts

Failures Configs
firestore [TEST] [FLAKINESS] [Android] [1/3 os: ubuntu] [1/2 android_device: android_target]
(1 failed tests)  CRASH/TIMEOUT
[TEST] [FLAKINESS] [Android] [1/3 os: windows] [1/2 android_device: android_target]
(1 failed tests)  QueryTest.TestCanListenForTheSameQueryWithDifferentOptions

Add flaky tests to go/fpl-cpp-flake-tracker

@github-actions github-actions bot added the tests: succeeded This PR's integration tests succeeded. label Mar 17, 2022
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label Mar 17, 2022
@firebase firebase locked and limited conversation to collaborators Apr 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
skip-release-notes Skip release notes check tests: succeeded This PR's integration tests succeeded.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants